npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pixelml/agenticflow-sdk

v1.0.4

Published

AgenticFlow SDK — typed HTTP client for the AgenticFlow API.

Readme

@pixelml/agenticflow-sdk

Typed JavaScript / TypeScript SDK for the AgenticFlow API. Manage agents, workflows, connections, node types and uploads from a single client object — with automatic auth, path-parameter resolution and structured error classes.

Installation

npm install @pixelml/agenticflow-sdk
# or
yarn add @pixelml/agenticflow-sdk
# or
pnpm add @pixelml/agenticflow-sdk

Requirements: Node.js ≥ 18

Quick Start

import { createClient } from "@pixelml/agenticflow-sdk";

const client = createClient({
  apiKey: process.env.AGENTICFLOW_API_KEY,
  workspaceId: process.env.AGENTICFLOW_WORKSPACE_ID,
  projectId: process.env.AGENTICFLOW_PROJECT_ID,
});

// List agents
const agents = await client.agents.list();

// Run a workflow
const run = await client.workflows.run({
  workflow_id: "wf-abc123",
  input: { prompt: "Hello!" },
});

Configuration

| Option | Env Variable | Description | |---|---|---| | apiKey | AGENTICFLOW_API_KEY | API key (sent as Bearer token) | | workspaceId | AGENTICFLOW_WORKSPACE_ID | Default workspace ID | | projectId | AGENTICFLOW_PROJECT_ID | Default project ID | | baseUrl | — | API base URL (default: https://api.agenticflow.ai/) | | timeout | — | Request timeout in milliseconds | | defaultHeaders | — | Extra headers sent with every request |

Note: If apiKey is omitted, the SDK reads AGENTICFLOW_API_KEY from the environment automatically.

Resources

All resource methods return the response data directly (the parsed JSON body), not a wrapper object.

Agents

// List
await client.agents.list({ projectId, searchQuery, limit, offset });

// CRUD
await client.agents.create(payload);
await client.agents.get("agent-id");
await client.agents.update("agent-id", payload);
await client.agents.delete("agent-id");

// Anonymous access (no API key required)
await client.agents.getAnonymous("agent-id");

// Streaming — returns AgentStream with event-driven API
const stream = await client.agents.stream("agent-id", {
  id: "550e8400-e29b-41d4-a716-446655440000", // UUID (auto-generated if omitted)
  messages: [{ role: "user", content: "Hello!" }],
});

// Option 1: Event listeners
stream
  .on("textDelta", (delta) => process.stdout.write(delta))
  .on("toolCall", (tc) => console.log("Tool:", tc))
  .on("error", (err) => console.error(err))
  .on("end", () => console.log("\nDone"));
await stream.process();

// Option 2: Collect full text
const text = await stream.text();

// Option 3: Async iteration
for await (const part of stream) {
  console.log(part.type, part.value);
}

// Anonymous streaming (no API key required)
await client.agents.streamAnonymous("agent-id", { messages: [{ role: "user", content: "Hi" }] });

// File uploads
await client.agents.uploadFile("agent-id", payload);
await client.agents.getUploadSession("agent-id", "session-id");
await client.agents.uploadFileAnonymous("agent-id", payload);
await client.agents.getUploadSessionAnonymous("agent-id", "session-id");

### Workflows

```typescript
// List (requires workspaceId)
await client.workflows.list({ workspaceId, projectId, searchQuery, limit, offset });

// CRUD
await client.workflows.create(payload, workspaceId);
await client.workflows.get("workflow-id");
await client.workflows.getAnonymous("workflow-id");
await client.workflows.update("workflow-id", payload, workspaceId);
await client.workflows.delete("workflow-id", workspaceId);

// Runs
await client.workflows.run(payload);
await client.workflows.runAnonymous(payload);
await client.workflows.getRun("run-id");
await client.workflows.getRunAnonymous("run-id");
await client.workflows.listRuns("workflow-id", { workspaceId, limit, offset, sortOrder });
await client.workflows.runHistory("workflow-id", { limit, offset });

// Validation
await client.workflows.validate(payload);

### Connections

```typescript
// List (requires projectId)
await client.connections.list({ workspaceId, projectId, limit, offset });

// CRUD
await client.connections.create(payload, workspaceId);
await client.connections.update("conn-id", payload, workspaceId);
await client.connections.delete("conn-id", workspaceId);

// Default connection for a category
await client.connections.getDefault({ categoryName: "llm", workspaceId, projectId });

// List categories
await client.connections.categories({ workspaceId, limit, offset });

Node Types

// List & get
await client.nodeTypes.list();
await client.nodeTypes.get("node-type-name");

// Search (client-side text match)
await client.nodeTypes.search("text generation");

// Dynamic field options
await client.nodeTypes.dynamicOptions({
  name: "node-type-name",
  fieldName: "model",
  connection: "conn-id",
  projectId: "proj-id",
  searchTerm: "gpt",
});

Uploads

// Anonymous upload sessions
await client.uploads.inputCreate({ filename: "data.csv" });
await client.uploads.inputStatus("session-id");

Error Handling

The SDK throws structured errors for every non-2xx response:

import {
  AuthenticationError,
  NotFoundError,
  RateLimitError,
} from "@pixelml/agenticflow-sdk";

try {
  await client.agents.get("invalid-id");
} catch (err) {
  if (err instanceof NotFoundError) {
    console.log(err.statusCode); // 404
    console.log(err.message);
    console.log(err.payload);    // raw response body
    console.log(err.requestId);  // X-Request-Id if present
  }
}

| Error Class | HTTP Status | |---|---| | ValidationError | 400 / 422 | | AuthenticationError | 401 | | AuthorizationError | 403 | | NotFoundError | 404 | | ConflictError | 409 | | RateLimitError | 429 | | ServerError | 5xx | | NetworkError | Connection / DNS failures | | RequestTimeoutError | Timeout exceeded |

All API errors extend APIError, which extends AgenticFlowError (→ Error).

Low-Level Access

For endpoints not covered by resource classes, use the SDK instance directly:

// HTTP convenience methods
const data = await client.sdk.get("/v1/health");
const data = await client.sdk.post("/v1/custom", { json: { key: "value" } });
const data = await client.sdk.put("/v1/custom/123", { json: payload });
const data = await client.sdk.patch("/v1/custom/123", { json: patch });
const data = await client.sdk.delete("/v1/custom/123");

// Full control
const data = await client.sdk.request("POST", "/v1/agents/{agent_id}/run", {
  pathParams: { agent_id: "abc" },
  queryParams: { verbose: true },
  json: { input: "Hello" },
  headers: { "X-Custom": "value" },
});

License

Apache-2.0