> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Devin SDK examples

> Six runnable Devin SDK programs from the devin-sdk-examples repository: a ten-line quickstart, a deployable webhook, Next.js and Cloudflare Agents chats.

The examples live in
[`COG-GTM/devin-sdk-examples`](https://github.com/COG-GTM/devin-sdk-examples), one folder per
example. Each is a standalone project with its own README and `package.json` that installs the
published `@cognition-ai` packages from npm. The pages here explain what each one shows and where
to look in the code; the code itself lives on GitHub.

> [card] [Quickstart](https://docs.devin.ai/sdk/examples/quickstart.md)
>
> `createDevin()` → `createSession()` → `run()`, then a `switch` over every event type. Cloud or
> local with one flag.

> [card] [Anthropic agent patterns](https://docs.devin.ai/sdk/examples/anthropic-patterns.md)
>
> Chaining, routing, parallelization, orchestrator-workers and evaluator-optimizer, each built on
> typed structured output.

> [card] [Harness chat](https://docs.devin.ai/sdk/examples/harness-chat.md)
>
> A Next.js chat where the AI SDK `HarnessAgent` runs Devin in a Vercel Sandbox, streamed to
> `useChat`.

> [card] [Cloudflare Agents chat](https://docs.devin.ai/sdk/examples/cloudflare-agents.md)
>
> A chat on Cloudflare Workers where each conversation is an `AIChatAgent` Durable Object driving
> a Devin cloud session, streamed to `useAgentChat`.

> [card] [Session board](https://docs.devin.ai/sdk/examples/session-board.md)
>
> A Next.js board of every cloud session, moving live between working, needs you and done, on
> one server-side WebSocket.

> [card] [Ticket enricher](https://docs.devin.ai/sdk/examples/ticket-enricher.md)
>
> A help desk webhook whose business logic is a Devin session returning a typed `Enrichment`.

## Running any of them

You need [Bun](https://bun.com) and Node.js 22 or newer. Clone the repository and install inside
the example you want; there is no shared build step:

```sh theme={null}
git clone https://github.com/COG-GTM/devin-sdk-examples
cd devin-sdk-examples/<example>
bun install
export DEVIN_API_KEY=cog_…     # app.devin.ai → Settings → API keys
```

then the example's `bun run …` script (listed on its page). Each `package.json` pins the
`@cognition-ai` packages it uses to the same published beta, currently `0.0.1-beta.7`; see
[Installing the beta](https://docs.devin.ai/sdk/quickstart.md#install) for how the `beta` dist-tag works.

The examples track the current beta, and the repository is tagged per release
(`v0.0.1-beta.7`, `v0.0.1-beta.6`, `v0.0.1-beta.5`, `v0.0.1-beta.4`, `v0.0.1-beta.2`, `v0.0.1-beta.1`, …), so the examples that match an earlier version are a
`git checkout` of its tag. Two of the six need a later beta than `0.0.1-beta.1` — the quickstart
needs `0.0.1-beta.6` or later (it passes `acpVersion` to `createDevin()` for its `--acp-v1` flag, an
option added in beta.6) and the Cloudflare Agents chat needs `0.0.1-beta.2` or later (its package is
new in beta.2); the other four also compile against `0.0.1-beta.1`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.