Skip to main content

Action Agents

Use the ActionFlows TypeScript SDK to discover Action Agents. Chat moved to the OpenAI-compatible /v1/chat/completions endpoint.

Action Agents

Use the TypeScript SDK to discover an agent configured in Action Agent Studio. The SDK does not create, update, activate, or delete agents.

import { ActionFlows } from "actionflows";

const client = new ActionFlows({
  apiKey: process.env.ACTIONFLOWS_API_KEY!,
});

See Installation for package setup and authentication.

Breaking change: agent chat moved to the OpenAI-compatible endpoint. The SDK chat methods startActionAgentSession, sendActionAgentMessage, sendActionAgentSessionMessage, and streamActionAgentChat (and their stream events) were removed. Use any OpenAI-compatible client against https://api.actionflows.ai/v1 with the agent id as model; see the migration note below.

Public agent metadata

const agents = await client.listActionAgents({
  organizationId: "org_123",
});

const agent = await client.getActionAgent("agent_123", "org_123");

These methods return public discovery metadata: IDs, names, descriptions, active state, organization ID, selected service and model names, tags, and timestamps. They omit the system prompt, Action Agent Studio layout, tools, MCP configuration, provider credential mode, and configVersion.

organizationId is optional only when the API key is already organization-scoped. A user-scoped key must select an organization that the user can access.

Chat with an agent (OpenAI-compatible)

Use the OpenAI SDK (or any OpenAI-compatible client) with the ActionFlows base URL. The agent id is the model:

import OpenAI from "openai";

const openai = new OpenAI({
  apiKey: process.env.ACTIONFLOWS_API_KEY!,
  baseURL: "https://api.actionflows.ai/v1",
});

const completion = await openai.chat.completions.create({
  messages: [{ role: "user", content: "Where is my invoice?" }],
  model: "agent_123",
});

console.log(completion.choices[0]?.message.content);

Every request without a session header starts a new durable session. To continue a conversation, capture the x-actionflows-session-id response header and send it back as X-ActionFlows-Session-Id; OpenAI clients expose custom headers through their client options (defaultHeaders on openai-node). Only the last user message drives the turn — the agent owns its transcript per session.

See Sessions & chat for session sources, isolation, response modes, and the Lead Review contract, and the Agents API reference for the wire format.

On this page