Agent SDK

Agent SDK is for applications that run multi-step agents. JoyToken handles model calls and usage attribution; tool execution, state storage, approvals, and business logic stay in your application.

Supported Capabilities

CapabilityStatus
JoyToken model providerSupported
Multi-step agent loopSupported
Function tool callsSupported
Stop conditionsSupports stepCountIs, maxToolCalls, maxCost
State persistenceSave messages in your app and pass them back to agent.run()

Required Values

ItemValue
Package@joytoken/agent-sdk-ts
API keyJOY_TOKEN_API_KEY
Default modelauto
Node.js18+

Minimal Agent

1import { Agent, createJoyTokenProvider } from "@joytoken/agent-sdk-ts";
2
3const agent = new Agent({
4 model: createJoyTokenProvider({
5 apiKey: process.env.JOY_TOKEN_API_KEY,
6 }),
7 modelName: "auto",
8 system: "Keep answers short.",
9});
10
11const result = await agent.run("Reply with exactly: pong");
12console.log(result.finalText);

When to Use Agent SDK

ScenarioRecommendation
One model requestUse Client SDK
Tool callsUse Agent SDK
Multi-step execution and stop conditionsUse Agent SDK
OpenClaw or Hermes Agent integrationUse Agent Integration

Next Steps

PageUse it for
QuickstartRun your first agent
ExamplesCopy tool, state, and stop-condition examples
TypeScript SDKRead TypeScript usage