Files
dependabot[bot] 16c8d14307 build(deps): bump node from 22-alpine to 26-alpine in /examples/async-subagent-server in the major-deps-updates-docker group (#683)
Bumps the major-deps-updates-docker group in
/examples/async-subagent-server with 1 update: node.

Updates `node` from 22-alpine to 26-alpine


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=node&package-manager=docker&previous-version=22-alpine&new-version=26-alpine)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-19 17:04:25 -07:00
..
2026-04-01 17:10:16 -07:00
2026-04-01 17:10:16 -07:00

Async Subagent Server

A self-hosted Agent Protocol server that exposes a DeepAgents researcher as an async subagent. Use this as a starting point for hosting your own agent on any infrastructure and connecting it to a DeepAgents supervisor.

The example includes both sides of the pattern:

  • server.ts — the Hono server your subagent runs on
  • supervisor.ts — an interactive REPL showing how to connect to it

Prerequisites

  • ANTHROPIC_API_KEY — required
  • TAVILY_API_KEY — optional; stub search is used if not set

Quickstart

1. Install and build (from the repo root):

pnpm install
pnpm --filter deepagents build

2. Set up your environment:

cd examples/async-subagent-server
cp .env.example .env
# fill in ANTHROPIC_API_KEY (and optionally TAVILY_API_KEY)

3. Start the server and Postgres:

docker compose up

4. In another terminal, start the supervisor:

cd examples
tsx async-subagent-server/supervisor.ts

Try these prompts:

> research the latest developments in quantum computing
> check status of <task-id>
> update <task-id> to focus on commercial applications only
> cancel <task-id>
> list all tasks

Run locally (bring your own Postgres)

If you already have Postgres running, skip Docker Compose and point the server at your database:

cd examples
DATABASE_URL=postgres://user:pass@localhost:5432/agentdb tsx async-subagent-server/server.ts

The server creates the threads and runs tables automatically on startup.

Then start the supervisor in another terminal:

cd examples
tsx async-subagent-server/supervisor.ts

Run with Docker (server only)

Build from the repo root (required because deepagents is a workspace dependency):

docker build -f examples/async-subagent-server/Dockerfile -t async-subagent-server .

docker run -p 2024:2024 \
  -e ANTHROPIC_API_KEY=your-key \
  -e TAVILY_API_KEY=your-key \
  -e DATABASE_URL=postgres://user:pass@your-db-host:5432/agentdb \
  async-subagent-server

Implemented endpoints

These are the Agent Protocol endpoints the DeepAgents async subagent middleware calls:

Endpoint Purpose
POST /threads Create a thread for a new task
POST /threads/:threadId/runs Start or interrupt+restart a run
GET /threads/:threadId/runs/:runId Poll run status
GET /threads/:threadId/state Fetch final output
POST /threads/:threadId/runs/:runId/cancel Cancel a run
GET /ok Health check

Swap in your own agent

Replace the createDeepAgent call in server.ts with your own agent. The Agent Protocol layer stays the same regardless of what the agent does.

const agent = createDeepAgent({
  systemPrompt: "You are a ...",
  tools: [yourTool],
});