Action Agents
List Action Agents, start sessions, send messages, and stream chat replies with the actionflows TypeScript SDK. Design agents in Studio.
Action Agents
Chat with agents you designed in Action Agent Studio. The SDK lists discovery metadata and runs chat. It does not create, update, or delete agents, and it does not return system prompt, layout, tools, or MCP config.
import { ActionFlows } from "actionflows";
const client = new ActionFlows({
apiKey: process.env.ACTIONFLOWS_API_KEY!,
});See Installation for install and auth.
Never put the API key in a browser or mobile client. Proxy agent chat through your backend.
List and get
const agents = await client.listActionAgents({ organizationId: "org_123" });
const agent = await client.getActionAgent("agent_123", "org_123");Metadata includes id, name, slug, active, model/service ids, and timestamps. REST: Action Agents API.
Sessions and messages
Each sessionId is one isolated chat. Do not reuse it across customers.
const session = await client.startActionAgentSession("agent_123", {
organizationId: "org_123",
endUserId: "user_abc",
});
const { text } = await client.sendActionAgentMessage("agent_123", session.sessionId, {
organizationId: "org_123",
message: "Where is my invoice?",
});sendActionAgentMessage never creates a session. A wrong sessionId fails.
To start a session only when you do not have an id yet:
const result = await client.sendActionAgentSessionMessage("agent_123", {
organizationId: "org_123",
message: "Hello",
// sessionId: "existing_session",
});
// result.sessionId is the id to pass on the next turnStream
for await (const event of client.streamActionAgentChat("agent_123", session.sessionId, {
organizationId: "org_123",
message: "Summarize refund policy in two sentences.",
})) {
if (event.type === "text-delta") {
process.stdout.write(event.delta);
}
if (event.type === "error") {
throw new Error(event.message);
}
}Resume an interrupted stream by calling streamActionAgentChat without message and with lastEventId. See Sessions & chat.