86 lines
2.9 KiB
Plaintext
86 lines
2.9 KiB
Plaintext
---
|
|
title: "Cline SDK"
|
|
sidebarTitle: "Overview"
|
|
description: "TypeScript packages for embedding Cline's agent runtime in your own applications."
|
|
---
|
|
|
|
The Cline SDK is an open source framework for building agentic applications, and is the same harness used in the Cline IDE extensions and CLI. It uses a plugin architecture that makes it easy to customize and comes with all the features you expect from agents like checkpoints, web fetch, MCPs, cron jobs, subagents, and more.
|
|
|
|
Use the Cline SDK to run agents from CI/CD pipelines, create automations for end-to-end workflows, or embed agents directly inside your products.
|
|
|
|
## Install
|
|
|
|
```bash
|
|
npm install @cline/sdk
|
|
```
|
|
|
|
`@cline/sdk` exports all SDK packages: `@cline/core` for the full agent harness, `@cline/agents` for the stateless agent loop, `@cline/llms` for control over the model gateway, and `@cline/shared` for common utilities.
|
|
|
|
Requires Node.js 22 or later.
|
|
|
|
## SDK Skill
|
|
|
|
If you use a coding agent (Claude Code, Codex, Cline, etc.), install the [Cline SDK skill](https://github.com/cline/sdk-skill) to give your agent context on the SDK's APIs and best practices to help you build with the Cline SDK.
|
|
|
|
```bash
|
|
npx skills add cline/sdk-skill
|
|
```
|
|
|
|
Prompt it to scaffold agents, create custom tools, wire up plugins, configure providers, and more.
|
|
|
|
## Your First Agent
|
|
|
|
```typescript
|
|
import { Agent } from "@cline/sdk"
|
|
|
|
const agent = new Agent({
|
|
providerId: "anthropic",
|
|
modelId: "claude-sonnet-4-6",
|
|
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
maxIterations: 1,
|
|
})
|
|
|
|
agent.subscribe((event) => {
|
|
if (event.type === "assistant-text-delta") {
|
|
process.stdout.write(event.text ?? "")
|
|
}
|
|
})
|
|
|
|
const result = await agent.run("Explain what an SDK is in two sentences.")
|
|
```
|
|
|
|
<Note>
|
|
Here is a complete [quickstart example](https://github.com/cline/cline/tree/main/apps/examples/quickstart). Clone it and run `bun dev` to try it.
|
|
</Note>
|
|
|
|
## Packages
|
|
|
|
| Package | Purpose |
|
|
|---------|---------|
|
|
| `@cline/sdk` | Public SDK surface (re-exports `@cline/core`) |
|
|
| `@cline/core` | Node runtime for sessions, built-in tools, persistence, hub support, automation |
|
|
| `@cline/agents` | Browser-compatible stateless agent execution loop |
|
|
| `@cline/llms` | Provider gateway and model catalogs |
|
|
| `@cline/shared` | Types, schemas, tool helpers, hooks, storage helpers |
|
|
|
|
|
|
|
|
See [Packages](/sdk/architecture/overview) for package boundaries and exports.
|
|
|
|
## Next Steps
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Examples" icon="rocket" href="/sdk/examples">
|
|
Browse complete, runnable SDK examples.
|
|
</Card>
|
|
<Card title="Plugins" icon="diagram-project" href="/sdk/plugins">
|
|
Extend Cline's functionality.
|
|
</Card>
|
|
<Card title="Tools" icon="wrench" href="/sdk/tools">
|
|
Add actions the model can call.
|
|
</Card>
|
|
<Card title="Building an Agent" icon="code" href="/sdk/guides/building-an-agent">
|
|
Build a complete SDK agent from a tutorial.
|
|
</Card>
|
|
</CardGroup>
|