AGNT5 TypeScript SDK
Build durable functions, workflows, and AI agents in TypeScript with the @agnt5/sdk package
The TypeScript SDK (@agnt5/sdk) lets you define functions, workflows, agents, and tools in TypeScript, and run them on a worker that connects to AGNT5. Every step a workflow checkpoints survives worker restarts, and every run is traced.
Installation
npm install @agnt5/sdkThe SDK runs on Node.js 22 or later. These pages describe version 0.10.14.
Quick example
A function does one unit of work, a workflow runs functions as checkpointed steps, and a worker registers them with AGNT5:
import { fn, workflow, Worker } from '@agnt5/sdk';
import type { Context } from '@agnt5/sdk';
export const greet = fn('greet').run(
async (ctx: Context, input: { name: string }) => `Hello, ${input.name}!`,
);
export const welcome = workflow('welcome', async (ctx: Context, input: { name: string }) => {
const message = await ctx.step('greet', () => greet(ctx, { name: input.name }));
return { message };
});
const worker = new Worker('quickstart', { serviceVersion: '0.1.0' });
await worker.run();Run it with agnt5 dev, then trigger the workflow:
agnt5 run welcome --type workflow --input '{"name": "Ada"}'What’s in the SDK
| Export | Use it to |
|---|---|
fn(name).run(handler) | Define a function: one unit of work with retries and tracing |
workflow(name, handler) | Define a workflow that runs steps with ctx.step() |
Agent, LM | Run an agent loop over a language model |
tool(...) | Give an agent a tool it can call |
Worker | Register components and connect them to AGNT5 |
Client | Run components and evaluate them from your own code |
The package also has entry points for serverless endpoints: @agnt5/sdk/serverless, @agnt5/sdk/serverless/node, and @agnt5/sdk/serverless/cloudflare.
Next steps
- Getting started: create a project, run it locally, and deploy it.
- Build with AGNT5: guides for functions, workflows, agents, tools, and more, with TypeScript examples on every page.
Modules
- Getting startedCreate a TypeScript AGNT5 project, run it locally with agnt5 dev, and deploy it
- FunctionsDefine functions with fn(), configure retries and schemas, and call them from workflows
- WorkflowsDefine workflows with workflow(), checkpoint steps, keep state, and run child workflows
- Context APIThe Context object every TypeScript handler receives — run details, steps, state, waits, signals, logging, and progress
- AgentsCreate agents with new Agent(), run or stream them, hand off between agents, and hook into the loop with callbacks
- ToolsDefine tools with tool() or the Tool class, give them a schema, and let agents call them
- LMCall language models directly with LM — providers, generate, stream, structured output, and prompts
- WorkerStart a TypeScript worker, register components and agents, and connect them to AGNT5
- ClientRun components, follow runs, run batches, and evaluate components from your own TypeScript code