The better way tocompose agentsin TypeScript

>_buncreatebetter-agent

The Best DX

server.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
context is missing required property 'userId'
client.ts
1
2
3
4
5
6
7
8
9
10
context is missing required property 'userId'

Features

01Composable Agents

Build larger agent systems from smaller agents, tools, and shared runtime parts.

02Multi-Provider

Swap models with one line. Same API across supported providers.

+more
03Plugins

Add app-level guards, event middleware, schema, and server endpoints with plugins.

authipAllowlistloggingrateLimitguardsmiddlewaresendpointspoliciesauthipAllowlistloggingrateLimitguardsmiddlewaresendpointspolicies
04Framework Agnostic

Use Better Agent with your stack instead of building around a fixed app framework.

05Event Driven

Listen to structured runtime events for runs, messages, tools, and approvals.

06Durable Runs

Replay streams and resume conversations from saved run state.

07Human in the Loop

Pause sensitive tool calls until a user submits an approval decision.

08Structured Output

Attach output schemas to agents or runs and get validated typed results back.

09Client and Server Tools

Use tools that run on the server, return on the client, or come from the provider.

Works with

Primitives

Build on the primitives you need

export const supportAgent = defineAgent({
  name: "support",
  model: openai.model("gpt-5.4"),
  instruction: "Help users resolve account issues.",
  tools: [searchDocsTool, createTicketTool],
});
Try it out
npm create better-agent
Terminal