Watch how an SDK agent runs end to end: streaming model output, calling tools, and finishing the task.
A complete agent runtime, packaged so you can ship it inside your own workflows and products.
Sessions, message history, tool approval, persistence, hub support, scheduling. The pieces we battle test in the Cline IDE and CLI ship with the SDK.
Add custom tools with a zod schema, register lifecycle hooks for policy and observability, or bundle everything into a reusable plugin you can share.
Route through Anthropic, OpenAI, Google, Bedrock, Vertex, Ollama, OpenRouter, or any OpenAI compatible endpoint. Switch providers without rewriting your agent.
Embed the SDK in CI/CD pipelines, queue workers, cron jobs, internal tools, Tauri desktop apps, or your own product. Streaming events let you wire any UI.
Read the source, fork the runtime, or vendor the packages you need. The SDK is part of the same open source repository as Cline.
Load MCP servers, use the built in tool suite for files, search, shell, web, and skills, or compose your own. The agent treats them all uniformly.
Pick the surface area you need. Everything else is opt in.
A stateless agent loop. Send a prompt, stream events, get a result. Perfect for one shot tasks, scripts, and lightweight in process use.
import { Agent } from "@cline/sdk" const agent = new Agent({ providerId: "anthropic", modelId: "claude-sonnet-4-6", apiKey: process.env.ANTHROPIC_API_KEY,}) agent.subscribe((event) => { if (event.type === "assistant-text-delta") { process.stdout.write(event.text ?? "") }}) const result = await agent.run( "Summarize the changes in this branch.") Take the whole harness, or pull in only the pieces you need. The SDK is modular so you can vendor as little or as much as fits your stack.
@cline/sdkThe umbrella package. Re-exports the runtime, agent, providers, and helpers.
@cline/coreSessions, built in tools, persistence, hub support, scheduling, plugin loading.
@cline/agentsThe agent execution loop on its own. Browser compatible, lightweight, no built ins.
@cline/llmsProvider clients and model catalogs. Drop in to plug into your own routing layer.
@cline/sharedTypes, schemas, tool helpers, hooks, and storage primitives shared across packages.
Requires Node.js 22+
Working examples in the repo. Clone, run, modify.
quickstartBeginnerSend one prompt, stream the response. The smallest possible SDK app, roughly 15 lines of TypeScript.
View on GitHubcli-agentBeginnerAn interactive terminal chat with a shell tool. A great template for building scriptable agents.
View on GitHubcode-review-botIntermediateAn AI code reviewer that defines custom tools, structures its output, and exits cleanly. Wire it into CI.
View on GitHubmulti-agentAdvancedParallel agents with a streaming web UI. Demonstrates fan out, fan in patterns and live event streams.
View on GitHubdesktop-appAdvancedA full Tauri plus Next.js desktop application built on the SDK. Production grade reference architecture.
View on GitHubBuild a Slackbot that triages bug reports, a CLI that scaffolds services, or a queue worker that grooms backlogs.
Run code review, dependency audits, migration generators, or release note drafters on every pull request.
Ship an agent inside your product. Wire its events into your own UI, persistence, and approval flows.
Full API reference, guides for building agents, tools, plugins, and runtime modes.
Read the docsRead the runtime, file an issue, or contribute. The SDK lives in the main Cline repo.
View on GitHubInstall the Cline SDK skill in Claude Code, Codex, or Cline so your coding agent scaffolds with SDK best practices.
Add the skillThe Cline SDK is open source and free to use. Install, build, and ship.
npm install @cline/sdk