Skip to content

TypeScript SDKAGNT5 TypeScript SDK

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/sdk

The 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

ExportUse 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, LMRun an agent loop over a language model
tool(...)Give an agent a tool it can call
WorkerRegister components and connect them to AGNT5
ClientRun 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