Skip to content

Commit 4eeefd9

Browse files
docs: refresh agents documentation (#4491)
## Preview https://deploy-preview-4491--electric-next.netlify.app/docs/agents/ ## Summary - Refresh agents docs against the current runtime, server, CLI, client, and built-in agent APIs. - Add dedicated usage pages for permissions, sandboxing, attachments, signals, and event sources. - Update sidebar/navigation plus stale references for Horton, Worker, collections, pull-wake built-ins, MCP, runtime clients, and model examples. ## Test plan - `nvm use 22 && pnpm --dir website exec vitepress build .` - Stale-term grep for removed agents docs patterns: old Coder references, old model IDs, `brave_search`, `removeTag`, stale `send()`/status snippets, and old attachment subject shape. - Cursor lints for edited agents docs and VitePress config. ## Notes - `pnpm --dir website run typecheck` was attempted earlier and still fails on pre-existing site-wide Vue type resolution issues unrelated to these docs changes. - VitePress build exits successfully, while printing existing site warnings from PGlite bundling and an SSR `requestAnimationFrame` warning in a blog component. Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 56fa8c3 commit 4eeefd9

41 files changed

Lines changed: 1740 additions & 251 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎website/.vitepress/config.mts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ const agentsDocsSidebar = [
260260
text: 'Managing state',
261261
link: '/docs/agents/usage/managing-state',
262262
},
263+
{
264+
text: 'Permissions & principals',
265+
link: '/docs/agents/usage/permissions-and-principals',
266+
},
263267
{
264268
text: 'Spawning & coordinating',
265269
link: '/docs/agents/usage/spawning-and-coordinating',
@@ -268,6 +272,9 @@ const agentsDocsSidebar = [
268272
text: 'Waking entities',
269273
link: '/docs/agents/usage/waking-entities',
270274
},
275+
{ text: 'Signals', link: '/docs/agents/usage/signals' },
276+
{ text: 'Sandboxing', link: '/docs/agents/usage/sandboxing' },
277+
{ text: 'Attachments', link: '/docs/agents/usage/attachments' },
271278
{ text: 'Shared state', link: '/docs/agents/usage/shared-state' },
272279
{
273280
text: 'Clients & React',
@@ -282,6 +289,7 @@ const agentsDocsSidebar = [
282289
text: 'Embedded built-ins',
283290
link: '/docs/agents/usage/embedded-builtins',
284291
},
292+
{ text: 'Webhook sources', link: '/docs/agents/usage/webhook-sources' },
285293
{ text: 'MCP servers', link: '/docs/agents/usage/mcp-servers' },
286294
{ text: 'Testing', link: '/docs/agents/usage/testing' },
287295
],

‎website/docs/agents/entities/agents/horton.md‎

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,36 @@ npx electric-ax agents observe /horton/my-horton
2626
2727
Horton is configured with `ctx.electricTools` plus the base Horton tool set:
2828
29-
| Tool | Purpose |
30-
| -------------- | -------------------------------------------------------- |
31-
| `bash` | Run shell commands in the working directory. |
32-
| `read` | Read a file. Tracked in a per-wake `readSet`. |
33-
| `write` | Create or overwrite a file. |
34-
| `edit` | Targeted string replacement (file must be `read` first). |
35-
| `brave_search` | Web search via the Brave Search API. |
36-
| `fetch_url` | Fetch a URL and return it as markdown. |
37-
| `spawn_worker` | Dispatch a subagent for an isolated subtask. |
38-
39-
`brave_search` requires `BRAVE_SEARCH_API_KEY` in the environment; without it the tool errors at call time.
40-
41-
When docs support or skills are available, Horton also adds the docs search tool and skill tools during bootstrap.
29+
| Tool | Purpose |
30+
| ----------------- | -------------------------------------------------------- |
31+
| `bash` | Run shell commands in the working directory. |
32+
| `read` | Read a file. Tracked in a per-wake `readSet`. |
33+
| `write` | Create or overwrite a file. |
34+
| `edit` | Targeted string replacement (file must be `read` first). |
35+
| `web_search` | Web search via the configured search provider. |
36+
| `fetch_url` | Fetch a URL and return it as markdown. |
37+
| `spawn_worker` | Dispatch a subagent for an isolated subtask. |
38+
| `fork` | Branch a session at its latest completed response. |
39+
| `observe_pg_sync` | Observe an Electric Postgres shape and wake on changes. |
40+
| `unobserve_pg_sync` | Remove an existing pg-sync observation. |
41+
| `send` | Send a message to another entity. |
42+
| `set_title` | Rename the current chat session title. |
43+
44+
`web_search` uses the search provider configured by the built-in runtime; Brave search requires `BRAVE_SEARCH_API_KEY`.
45+
46+
When docs support or skills are available, Horton also adds the docs search tool and skill tools during bootstrap. Built-in runtimes also provide `ctx.electricTools`, including schedule tools and webhook-source tools when configured.
4247
4348
## Title generation
4449
45-
After the first agent run completes, Horton calls `generateTitle()` (Haiku) to summarise the user's first message into a 3-5 word session title and stores it via `ctx.setTag('title', title)`. Failures are logged and ignored — the entity continues without a title.
50+
After the first agent run completes, Horton calls `generateTitle()` using the configured low-cost model to summarise the user's first message into a 3-5 word session title and stores it via `ctx.setTag('title', title)`. Failures are logged and ignored — the entity continues without a title.
4651

4752
## Details
4853

4954
| Property | Value |
5055
| ----------------- | ------------------------------------------------- |
5156
| Type name | `horton` |
52-
| Model | `HORTON_MODEL` (`claude-sonnet-4-5-20250929`) |
53-
| Title model | `claude-haiku-4-5-20251001` |
57+
| Model | `HORTON_MODEL` (`claude-sonnet-4-6` by default) |
58+
| Title model | Configured low-cost model |
5459
| Tools | `ctx.electricTools` + base Horton tool set, plus docs/skill tools when configured |
5560
| Working directory | Passed at bootstrap (defaults to `process.cwd()`) |
5661
| Title generation | Yes, after the first run if no title tag exists |
@@ -75,7 +80,7 @@ registry.define("my-assistant", {
7580
model: HORTON_MODEL,
7681
tools: [
7782
...ctx.electricTools,
78-
...createHortonTools(process.cwd(), ctx, readSet),
83+
...createHortonTools(ctx.sandbox, ctx, readSet),
7984
myCustomTool,
8085
],
8186
})

‎website/docs/agents/entities/agents/worker.md‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ interface WorkerArgs {
2020
tools?: Array<WorkerToolName>
2121
sharedDb?: { id: string; schema: SharedStateSchemaMap }
2222
sharedDbToolMode?: "full" | "write-only"
23+
model?: string
24+
provider?: string
25+
reasoningEffort?: string
2326
}
2427
```
2528

@@ -29,8 +32,11 @@ interface WorkerArgs {
2932
| `tools` | No | Subset of valid tool names (see below). Unknown names throw at parse time. |
3033
| `sharedDb` | No | Shared state stream id and schema to connect to. |
3134
| `sharedDbToolMode` | No | Shared state tool mode: `"full"` (default) or `"write-only"`. |
35+
| `model` | No | Model id override. Usually inherited from `spawn_worker` / Horton model config. |
36+
| `provider` | No | Model provider override paired with `model`. |
37+
| `reasoningEffort` | No | Reasoning effort override for compatible reasoning models. |
3238

33-
`registerWorker(registry, { workingDirectory, streamFn? })` is called by the dev server during bootstrap; you don't usually call it yourself.
39+
`registerWorker(registry, { workingDirectory, modelCatalog, streamFn? })` is called by the dev server during bootstrap; you don't usually call it yourself. The bootstrap path supplies the required `modelCatalog`.
3440

3541
## Valid tool names
3642

@@ -40,9 +46,10 @@ type WorkerToolName =
4046
| "read"
4147
| "write"
4248
| "edit"
43-
| "brave_search"
49+
| "web_search"
4450
| "fetch_url"
4551
| "spawn_worker"
52+
| "send"
4653
```
4754
4855
These are the same primitives Horton uses. Pick the smallest subset the worker needs — tools are the worker's permission set.
@@ -57,7 +64,7 @@ The canonical way to spawn a worker is the `spawn_worker` tool, which Horton cal
5764
spawn_worker({
5865
systemPrompt:
5966
"You are a focused researcher. Find the three most-cited papers on X and return their titles, authors, and DOIs as a markdown table.",
60-
tools: ["brave_search", "fetch_url"],
67+
tools: ["web_search", "fetch_url"],
6168
initialMessage: "Begin research now.",
6269
})
6370
```
@@ -75,7 +82,7 @@ The spawn uses `wake: { on: 'runFinished', includeResponse: true }`, so the spaw
7582
1. Parses `ctx.args` into `WorkerArgs`. Throws if `systemPrompt` is empty, if `tools` contains an unknown name, or if neither `tools` nor `sharedDb` is provided.
7683
2. Builds the requested tool instances against the worker's `workingDirectory` (and a fresh per-wake `readSet` for the read-first-then-edit guard).
7784
3. If `sharedDb` is present, connects with `ctx.observe(db(id, schema))` and exposes generated `read_*`, `write_*`, `update_*`, and `delete_*` tools (`write_*` only in `"write-only"` mode).
78-
4. Configures the agent with `HORTON_MODEL` (`claude-sonnet-4-5-20250929`), the provided system prompt (with a brief reporting-back footer appended), and the assembled tool list.
85+
4. Configures the agent with `HORTON_MODEL` (`claude-sonnet-4-6` by default), the provided system prompt (with a brief reporting-back footer appended), and the assembled tool list.
7986
5. Runs the agent until the LLM stops.
8087
8188
::: warning Least-privilege sandbox
@@ -96,7 +103,7 @@ When you finish, respond with a concise report covering what was done and any ke
96103
| Property | Value |
97104
| ----------------- | --------------------------------------------------------------------- |
98105
| Type name | `worker` |
99-
| Model | `HORTON_MODEL` (`claude-sonnet-4-5-20250929`) |
100-
| Tools | Subset of 7 primitives plus optional shared-state tools. **No `ctx.electricTools`.** |
106+
| Model | `HORTON_MODEL` (`claude-sonnet-4-6` by default) |
107+
| Tools | Subset of 8 primitives plus optional shared-state tools. **No `ctx.electricTools`.** |
101108
| Working directory | Provided to `registerWorker` at bootstrap |
102109
| Description | `Internal — generic worker spawned by other agents. Configure via spawn args (systemPrompt + tools + optional sharedDb).` |

‎website/docs/agents/entities/patterns/blackboard.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function registerDebate(registry: EntityRegistry) {
5858

5959
ctx.useAgent({
6060
systemPrompt: DEBATE_SYSTEM_PROMPT,
61-
model: `claude-sonnet-4-5-20250929`,
61+
model: `claude-sonnet-4-6`,
6262
tools: [...ctx.electricTools, startTool, checkTool, endTool],
6363
})
6464
await ctx.agent.run()

‎website/docs/agents/entities/patterns/dispatcher.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function registerDispatcher(registry: EntityRegistry) {
2424

2525
ctx.useAgent({
2626
systemPrompt: DISPATCHER_SYSTEM_PROMPT,
27-
model: `claude-sonnet-4-5-20250929`,
27+
model: `claude-sonnet-4-6`,
2828
tools: [...ctx.electricTools, dispatchTool],
2929
})
3030
await ctx.agent.run()

‎website/docs/agents/entities/patterns/manager-worker.md‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function registerManagerWorker(registry: EntityRegistry) {
2727

2828
ctx.useAgent({
2929
systemPrompt: MANAGER_SYSTEM_PROMPT,
30-
model: `claude-sonnet-4-5-20250929`,
30+
model: `claude-sonnet-4-6`,
3131
tools: [...ctx.electricTools, analyzeTool],
3232
})
3333
await ctx.agent.run()
@@ -92,10 +92,15 @@ Do not wait for worker output inside the same wake. Spawn workers with `wake: {
9292
```ts
9393
const finished = wake.payload?.finished_child
9494
if (finished) {
95-
ctx.state.workers.update(finished.url, (draft) => {
96-
draft.status = finished.run_status
97-
draft.output = finished.response ?? ""
98-
})
95+
const child = ctx.state.children.toArray.find(
96+
(entry) => entry.url === finished.url
97+
)
98+
if (child) {
99+
ctx.state.children.update(child.key, (draft) => {
100+
draft.status = finished.run_status
101+
draft.output = finished.response ?? ""
102+
})
103+
}
99104
}
100105
```
101106

‎website/docs/agents/entities/patterns/map-reduce.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function registerMapReduce(registry: EntityRegistry) {
2525
async handler(ctx) {
2626
ctx.useAgent({
2727
systemPrompt: MAP_REDUCE_SYSTEM_PROMPT,
28-
model: `claude-sonnet-4-5-20250929`,
28+
model: `claude-sonnet-4-6`,
2929
tools: [...ctx.electricTools, createMapChunksTool(ctx)],
3030
})
3131
await ctx.agent.run()

‎website/docs/agents/entities/patterns/pipeline.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function registerPipeline(registry: EntityRegistry) {
2525
async handler(ctx) {
2626
ctx.useAgent({
2727
systemPrompt: PIPELINE_SYSTEM_PROMPT,
28-
model: `claude-sonnet-4-5-20250929`,
28+
model: `claude-sonnet-4-6`,
2929
tools: [...ctx.electricTools, createRunStageTool(ctx)],
3030
})
3131
await ctx.agent.run()

‎website/docs/agents/entities/patterns/reactive-observers.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function registerMonitor(registry: EntityRegistry) {
5050

5151
ctx.useAgent({
5252
systemPrompt: MONITOR_SYSTEM_PROMPT,
53-
model: `claude-sonnet-4-5-20250929`,
53+
model: `claude-sonnet-4-6`,
5454
tools: [...ctx.electricTools, observeTool],
5555
})
5656
await ctx.agent.run()

‎website/docs/agents/index.md‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The runtime SDK is a layer over three foundations:
4444
- **[TanStack&nbsp;DB](https://tanstack.com/db)** — typed local reads and writes via collections.
4545
- **Mario Zechner's [pi](https://github.com/badlogic/pi-mono) toolkit** — `pi-ai` (unified multi-provider LLM API) and `pi-agent-core` (agent runtime) for the LLM agent loop.
4646

47-
**One stream per entity.** The runtime projects that stream into a typed local DB of collections — an `EntityStreamDB`. Inside a handler, that DB is `ctx.db`: writes go through `ctx.db.actions` (which append events to the stream), reads come from `ctx.db.collections`. The runtime ships [built-in collections](#built-in-collections) for runs, tool calls, text deltas, errors, inbox, and more, and you add your own typed [state](#state) collections per entity type.
47+
**One stream per entity.** The runtime projects that stream into a typed local DB of collections — an `EntityStreamDB`. Inside a handler, that DB is `ctx.db`: writes go through `ctx.db.actions` (which append events to the stream), reads come from `ctx.db.collections`. The runtime ships [built-in collections](#built-in-collections) for runs, tool calls, text deltas, errors, inbox, and more, and you add your own typed [state](/docs/agents/usage/managing-state) collections per entity type.
4848

4949
**Inside a handler.** When a handler calls `ctx.useAgent()`, the runtime configures the agent on its behalf and routes every step — model call, text delta, tool invocation, error — through the same projection, so the agent loop becomes durable events on the entity's stream.
5050

@@ -75,7 +75,7 @@ registry.define("support", {
7575
if (wake.type === "inbox") {
7676
ctx.useAgent({
7777
systemPrompt: "You are a support agent.",
78-
model: "claude-sonnet-4-5-20250929",
78+
model: "claude-sonnet-4-6",
7979
tools: [...ctx.electricTools, searchKbTool],
8080
})
8181
await ctx.agent.run()
@@ -110,7 +110,7 @@ The core pattern is [`ctx.useAgent()`](/docs/agents/reference/agent-config) foll
110110
```ts
111111
ctx.useAgent({
112112
systemPrompt: "You are a helpful assistant.",
113-
model: "claude-sonnet-4-5-20250929",
113+
model: "claude-sonnet-4-6",
114114
tools: [...ctx.electricTools, myCustomTool],
115115
})
116116

@@ -228,5 +228,7 @@ See [Managing state](/docs/agents/usage/managing-state) for more information.
228228
- [Writing handlers](/docs/agents/usage/writing-handlers) — handler lifecycle and the `ctx` API.
229229
- [Configuring the agent](/docs/agents/usage/configuring-the-agent) — `useAgent`, models, tools, and streaming.
230230
- [Spawning & coordinating](/docs/agents/usage/spawning-and-coordinating) — multi-entity topologies and shared state.
231-
- [Built-in agents](/docs/agents/entities/agents/horton) — Horton, Worker, and Coder, the agents that ship with the runtime.
231+
- [Permissions & principals](/docs/agents/usage/permissions-and-principals) — entity access control and principal-scoped clients.
232+
- [Sandboxing](/docs/agents/usage/sandboxing), [Attachments](/docs/agents/usage/attachments), [Signals](/docs/agents/usage/signals), and [Webhook sources](/docs/agents/usage/webhook-sources) — newer runtime capabilities for hosted agents.
233+
- [Built-in agents](/docs/agents/entities/agents/horton) — Horton and Worker, the agents that ship with the runtime.
232234
- [Examples](/docs/agents/examples/playground) — pattern walkthroughs and demo apps.

0 commit comments

Comments
 (0)