{"id":47082017,"url":"https://github.com/odysa/one-agent-sdk","last_synced_at":"2026-03-12T07:03:09.436Z","repository":{"id":342166401,"uuid":"1173023378","full_name":"odysa/one-agent-sdk","owner":"odysa","description":"A provider-agnostic TypeScript SDK for building LLM agents with tools and multi-agent handoffs. Write your agent once, run it on any backend — Claude Code, ChatGPT Codex, Kimi-CLI, and more.","archived":false,"fork":false,"pushed_at":"2026-03-05T04:58:05.000Z","size":89,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-05T07:42:36.853Z","etag":null,"topics":["agent","ai","claude-code","codex","sdk"],"latest_commit_sha":null,"homepage":"https://odysa.github.io/one-agent-sdk/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/odysa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-04T23:46:33.000Z","updated_at":"2026-03-05T05:23:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/odysa/one-agent-sdk","commit_stats":null,"previous_names":["odysa/open-agent-sdk"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/odysa/one-agent-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odysa%2Fone-agent-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odysa%2Fone-agent-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odysa%2Fone-agent-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odysa%2Fone-agent-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/odysa","download_url":"https://codeload.github.com/odysa/one-agent-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/odysa%2Fone-agent-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30417686,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T06:40:58.731Z","status":"ssl_error","status_checked_at":"2026-03-12T06:40:40.296Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai","claude-code","codex","sdk"],"created_at":"2026-03-12T07:03:07.757Z","updated_at":"2026-03-12T07:03:09.430Z","avatar_url":"https://github.com/odysa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cpicture\u003e\n  \u003cimg src=\"./assets/banner.svg\" alt=\"One Agent SDK\" width=\"100%\" /\u003e\n\u003c/picture\u003e\n\n\u003cbr /\u003e\n\n[![npm version](https://img.shields.io/npm/v/one-agent-sdk?style=flat-square\u0026color=cb3837\u0026label=npm)](https://www.npmjs.com/package/one-agent-sdk)\n[![CI](https://img.shields.io/github/actions/workflow/status/odysa/one-agent-sdk/ci.yml?style=flat-square\u0026label=CI)](https://github.com/odysa/one-agent-sdk/actions/workflows/ci.yml)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.8-3178c6?style=flat-square\u0026logo=typescript\u0026logoColor=white)](https://www.typescriptlang.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green?style=flat-square)](https://opensource.org/licenses/MIT)\n\n**Drop-in replacement for `@anthropic-ai/claude-agent-sdk` — same API, multiple providers.**\n\n\u003cbr /\u003e\n\n[Getting Started](#getting-started) · [Features](#features) · [Providers](#supported-providers) · [API Reference](#api-reference) · [Examples](#examples)\n\n\u003cbr /\u003e\n\n\u003c/div\u003e\n\n```typescript\nimport { query, tool, createSdkMcpServer } from \"one-agent-sdk\";\n\n// Same API as @anthropic-ai/claude-agent-sdk — swap provider with one option\nconst conversation = query({\n  prompt: \"What's the weather?\",\n  options: { provider: \"codex\" }, // or \"openai\", \"anthropic\", \"openrouter\", ...\n});\n```\n\n\u003cbr /\u003e\n\n## The Problem\n\n`@anthropic-ai/claude-agent-sdk` has a great API — but it only works with Claude Code. If you want to use Codex or Kimi, you have to learn a completely different SDK.\n\n## The Solution\n\nOne Agent SDK is a drop-in replacement for `@anthropic-ai/claude-agent-sdk` that routes to any backend. Same `query()`, `tool()`, `createSdkMcpServer()` — just pass `options.provider` to switch:\n\n```diff\n  const conversation = query({\n    prompt: \"Analyze this code\",\n-   options: { systemPrompt: \"You are helpful.\" },\n+   options: { systemPrompt: \"You are helpful.\", provider: \"codex\" },\n  });\n```\n\nEverything else stays the same: streaming, tools, message format — all of it.\n\n\u003cbr /\u003e\n\n## Supported Providers\n\n### CLI Agent Providers\n\nThese wrap CLI agent SDKs — no API keys needed, agents run as local subprocesses using your existing CLI authentication.\n\n| Provider | Package | Agent Backend |\n| :------- | :------ | :------------ |\n| `claude-code` | [`@anthropic-ai/claude-agent-sdk`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) | Claude Code |\n| `codex` | [`@openai/codex-sdk`](https://www.npmjs.com/package/@openai/codex-sdk) | ChatGPT Codex |\n| `copilot` | [`@github/copilot-sdk`](https://www.npmjs.com/package/@github/copilot-sdk) | GitHub Copilot |\n| `kimi-cli` | [`@moonshot-ai/kimi-agent-sdk`](https://www.npmjs.com/package/@moonshot-ai/kimi-agent-sdk) | Kimi-CLI |\n| `gemini-cli` | `@google/gemini-cli-core` | Gemini CLI (planned — pending stable SDK, see [#31](https://github.com/odysa/one-agent-sdk/issues/31)) |\n\n### API-Key Providers\n\nThese call LLM HTTP APIs directly with API keys — no CLI tooling required.\n\n| Provider | Package | API Backend |\n| :------- | :------ | :---------- |\n| `openai` | [`openai`](https://www.npmjs.com/package/openai) | OpenAI API (GPT-4o, etc.) |\n| `anthropic` | [`@anthropic-ai/sdk`](https://www.npmjs.com/package/@anthropic-ai/sdk) | Anthropic API (Claude Sonnet, etc.) |\n| `openrouter` | [`openai`](https://www.npmjs.com/package/openai) | [OpenRouter](https://openrouter.ai/) (any model) |\n\nAll providers are **optional peer dependencies** — install only what you need. You can also [register custom providers](#custom-providers).\n\n\u003cbr /\u003e\n\n## Getting Started\n\n### Prerequisites\n\n- [Node.js](https://nodejs.org/) v18+ or [Bun](https://bun.sh/)\n- At least one provider: either a CLI agent SDK installed and authenticated, or an API key\n\n### Install\n\n```bash\nnpm install one-agent-sdk\n```\n\nThen install your provider:\n\n```bash\n# CLI agent providers (pick one or more)\nnpm install @anthropic-ai/claude-agent-sdk\nnpm install @openai/codex-sdk\nnpm install @github/copilot-sdk\nnpm install @moonshot-ai/kimi-agent-sdk\n\n# API-key providers (pick one or more)\nnpm install openai              # for \"openai\" or \"openrouter\" provider\nnpm install @anthropic-ai/sdk   # for \"anthropic\" provider\n```\n\n### Quick Start\n\n```typescript\nimport { z } from \"zod\";\nimport { query, tool, createSdkMcpServer } from \"one-agent-sdk\";\n\nconst weatherTool = tool(\n  \"get_weather\",\n  \"Get the current weather for a city\",\n  { city: z.string().describe(\"City name\") },\n  async ({ city }) =\u003e ({\n    content: [{ type: \"text\" as const, text: JSON.stringify({ city, temperature: 72, condition: \"sunny\" }) }],\n  }),\n);\n\nconst mcpServer = createSdkMcpServer({\n  name: \"tools\",\n  version: \"1.0.0\",\n  tools: [weatherTool],\n});\n\nconst conversation = query({\n  prompt: \"What's the weather in San Francisco?\",\n  options: {\n    systemPrompt: \"You are a helpful assistant. Use the weather tool when asked about weather.\",\n    mcpServers: { tools: mcpServer },\n    allowedTools: [\"mcp__tools__get_weather\"],\n  },\n});\n\nfor await (const msg of conversation) {\n  if (msg.type === \"assistant\" \u0026\u0026 msg.message?.content) {\n    for (const block of msg.message.content) {\n      if (\"text\" in block \u0026\u0026 block.text) process.stdout.write(block.text);\n    }\n  }\n}\n```\n\n\u003e [!TIP]\n\u003e To switch providers, add `provider: \"codex\"`, `provider: \"openai\"`, etc. to `options`. Defaults to `\"claude-code\"`.\n\n\u003cbr /\u003e\n\n## Features\n\n### Multi-Provider Support\n\nSame code, different backend — just change `options.provider`:\n\n```typescript\nimport { query } from \"one-agent-sdk\";\n\n// Use Claude (default)\nconst claude = query({ prompt: \"Explain this code\" });\n\n// Use Codex\nconst codex = query({ prompt: \"Explain this code\", options: { provider: \"codex\" } });\n\n// Use OpenAI API directly\nconst openai = query({ prompt: \"Explain this code\", options: { provider: \"openai\" } });\n\n// Use Anthropic API directly\nconst anthropic = query({ prompt: \"Explain this code\", options: { provider: \"anthropic\" } });\n\n// Use any model via OpenRouter\nconst openrouter = query({ prompt: \"Explain this code\", options: { provider: \"openrouter\", model: \"anthropic/claude-sonnet-4\" } });\n```\n\nThe output stream always emits the same `SDKMessage` format, regardless of provider.\n\n### Custom Providers\n\nRegister your own provider backend and use it with `query()`:\n\n```typescript\nimport { registerProvider } from \"one-agent-sdk\";\nimport { query } from \"one-agent-sdk\";\n\nregisterProvider(\"my-llm\", async (config) =\u003e ({\n  async *run(prompt) {\n    yield { type: \"text\", text: \"Hello from my-llm!\" };\n    yield { type: \"done\" };\n  },\n  async *chat(msg) {\n    yield { type: \"text\", text: msg };\n    yield { type: \"done\" };\n  },\n  async close() {},\n}));\n\nconst conversation = query({ prompt: \"Hi\", options: { provider: \"my-llm\" } });\n```\n\n\u003cbr /\u003e\n\n## How It Works\n\n```mermaid\ngraph LR\n    A[\"query(prompt, options)\"] --\u003e B{options.provider}\n    B --\u003e|claude-code| C[\"@anthropic-ai/claude-agent-sdk\"]\n    B --\u003e|codex| D[\"@openai/codex-sdk\"]\n    B --\u003e|copilot| E[\"@github/copilot-sdk\"]\n    B --\u003e|kimi-cli| F[\"@moonshot-ai/kimi-agent-sdk\"]\n    B --\u003e|openai| G[\"OpenAI API\"]\n    B --\u003e|anthropic| H[\"Anthropic API\"]\n    B --\u003e|openrouter| I[\"OpenRouter API\"]\n    B --\u003e|custom| J[Registered Provider]\n    C --\u003e K[SDKMessage Stream]\n    D --\u003e K\n    E --\u003e K\n    F --\u003e K\n    G --\u003e K\n    H --\u003e K\n    I --\u003e K\n    J --\u003e K\n```\n\n- **`claude-code`** (default) — delegates directly to the real Anthropic SDK. Full fidelity, zero overhead.\n- **CLI providers** (`codex`, `copilot`, `kimi-cli`) — wraps CLI agent SDKs, adapts output to `SDKMessage` format.\n- **API providers** (`openai`, `anthropic`, `openrouter`) — calls LLM APIs directly with API keys, manages multi-turn tool loops internally.\n\n\u003e [!NOTE]\n\u003e Provider SDKs are dynamically imported at runtime — unused providers are never loaded.\n\n\u003cbr /\u003e\n\n## API Reference\n\n```typescript\nimport { query, tool, createSdkMcpServer } from \"one-agent-sdk\";\n```\n\n100% API-compatible with `@anthropic-ai/claude-agent-sdk`. All exports are identical — see the [Anthropic Agent SDK docs](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) for the full reference.\n\n**Added by One Agent SDK:**\n\n| Option | Description |\n| :------- | :---------- |\n| `options.provider` | Route to a different backend: `\"claude-code\"` (default), `\"codex\"`, `\"copilot\"`, `\"kimi-cli\"`, `\"openai\"`, `\"anthropic\"`, `\"openrouter\"`, or any registered custom provider |\n\n| Helper | Description |\n| :------- | :---------- |\n| `registerProvider(name, factory)` | Register a custom provider backend (import from `one-agent-sdk`) |\n\nFor full API documentation, see the [docs site](https://odysa.github.io/one-agent-sdk/).\n\n\u003cbr /\u003e\n\n## Examples\n\nThe [`examples/`](./examples) directory contains runnable demos:\n\n| Example | Description |\n| :------ | :---------- |\n| [`claude.ts`](./examples/claude.ts) | Claude with tools via `query()` + `tool()` |\n| [`codex.ts`](./examples/codex.ts) | Codex backend |\n| [`copilot.ts`](./examples/copilot.ts) | GitHub Copilot backend |\n| [`kimi.ts`](./examples/kimi.ts) | Kimi backend |\n| [`openai-api.ts`](./examples/openai-api.ts) | OpenAI API with tools |\n| [`anthropic-api.ts`](./examples/anthropic-api.ts) | Anthropic API with tools |\n| [`openrouter.ts`](./examples/openrouter.ts) | OpenRouter (any model) |\n| [`hello.ts`](./examples/hello.ts) | Minimal example (legacy API) |\n| [`multi-agent.ts`](./examples/multi-agent.ts) | Multi-agent handoffs (legacy API) |\n\n```bash\nnpx tsx examples/hello.ts\n```\n\n\u003cbr /\u003e\n\n## Legacy API (Deprecated)\n\nThe following functions are exported from `one-agent-sdk` and will be removed in v0.2. Migrate to `one-agent-sdk` instead.\n\n| Function | Replacement |\n| :------- | :---------- |\n| `run(prompt, config)` | `query({ prompt, options })` |\n| `runToCompletion(prompt, config)` | `query({ prompt, options })` + collect results |\n| `defineAgent({...})` | Pass agent config directly via `query()` options |\n| `defineTool({...})` | `tool(name, description, schema, handler)` |\n\n\u003cbr /\u003e\n\n## Contributing\n\nContributions are welcome! Please see the [contributing guide](CONTRIBUTING.md) for details.\n\n\u003cbr /\u003e\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodysa%2Fone-agent-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fodysa%2Fone-agent-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fodysa%2Fone-agent-sdk/lists"}