TypeScript SDK
Install @agent-commons/sdk and build with type-safe access to the full Agent Commons API.
TypeScript SDK
The @agent-commons/sdk package gives you typed access to the Agent Commons API from Node.js, modern browsers, and edge runtimes.
Installation
Setup
| Option | Type | Required | Description |
|---|---|---|---|
baseUrl | string | no | API origin. Defaults to https://api.agentcommons.io |
apiKey | string | for API calls | Project key from Settings → Developer API keys |
initiator | string | no | Optional delegated principal |
identityUrl | string | no | Commons Identity origin for developer-project operations |
identityToken | string | for developer | Commons Identity access token |
fetch | typeof fetch | no | Custom Fetch implementation |
Create a project-scoped csk_* key in Agent Commons → Settings → Developer API keys. Select only the scopes your application needs and set an expiration when practical. The plaintext key appears once, so copy it to your secret manager immediately.
Keep API keys on the server. Do not put them in browser bundles, mobile applications, or source control.
Agents
Running agents
Single run
Streaming
Stream event types:
| Type | Description |
|---|---|
| token | A chunk of response text |
| toolStart | Agent is invoking a tool |
| toolEnd | Tool returned a result |
| agent_step | Internal agent step |
| final | Run completed with final payload |
| completed | Run finished successfully |
| failed | Run failed |
| cancelled | Run was cancelled |
| status | Status update message |
| error | An error occurred |
| cli_tool_request | CLI-side tool invocation (used internally by the CLI) |
Sessions
Tasks
Workflows
Tools
MCP Servers
Connection types: stdio · sse · http · streamable-http
Memory
Memory types: episodic · semantic · procedural
Wallets
Wallet types: eoa · erc4337 · external
Developer projects and API keys
Developer keys are managed by Commons Identity and belong to a developer project. Use an account access token to manage projects and keys:
The older client.apiKeys namespace remains available for legacy sk-ac-* principal keys. Use client.developer for new integrations.