<!--
Sitemap:
- [Installation](/installation): Install the Bento daemon on macOS or Linux, then write your first pipeline to run a coding agent on a GitHub, Linear, or schedule event.
- [Upgrading](/upgrading): Version-specific steps for upgrading an existing Bento install.
- [Concepts](/concepts)
- [Build your first pipeline](/tutorials/pipeline-args)
- [Target a specific issue or PR from a URL](/tutorials/url-targeting)
- [Keep state across runs](/tutorials/pipeline-state)
- [Fire a pipeline on a schedule or on demand](/tutorials/schedule-and-fire)
- [Deploy a box to Railway](/tutorials/deploy-to-railway)
- [Operate a hosted daemon](/tutorials/operate-a-hosted-daemon)
- [Configuration](/configuration): Configure the Bento daemon with daemon.yaml: service name, port, webhooks, sandboxes, knowledge base, and environment variables.
- [Members](/members)
- [Knowledge base](/knowledge-base/)
- [Method and delivery](/knowledge-base/modes): Choose how Bento retrieves knowledge (BM25, vector, or hybrid) and how it delivers that knowledge to a coding agent.
- [Config](/knowledge-base/config)
- [MCP](/knowledge-base/mcp): Give coding agents your team knowledge over MCP. The Bento daemon serves an ask_knowledge search tool and per-file resources.
- [Pipeline configuration reference](/pipelines/config): Reference for Bento pipeline YAML: triggers, agents, skills, instructions, filters, sandboxes, structured results, and outputs.
- [Filters](/pipelines/filters): Filter GitHub, Linear, and webhook events by repository, label, and other fields so only the right Bento pipelines run.
- [Workflows](/pipelines/workflows): Group related Bento pipelines with their own agents, skills, and policies in one workflow directory under .bento/workflows.
- [Model routing](/pipelines/routing): Send each Bento pipeline run to the right model with named routes, label-based routing, and credential pools.
- [Orchestration](/pipelines/orchestration): Let an orchestrator decide how to dispatch a Bento pipeline: run one agent, fan out in parallel, or call typed capabilities.
- [Retries and failover](/pipelines/retries-and-failover): How Bento keeps runs going: route failover, sandbox fallbacks, queue retries, and the circuit breaker.
- [Triggers](/triggers/): Start a Bento pipeline from a GitHub, Linear, webhook, schedule, or manual trigger. Compare the trigger types and when each one fires.
- [GitHub trigger](/triggers/github): Run a coding agent on GitHub pull request, issue, and other webhook events. Configure HMAC verification and event patterns.
- [Linear trigger](/triggers/linear): Run a coding agent on Linear issue and comment events. Configure the Linear webhook, signature verification, and Hookdeck relay.
- [Webhook trigger](/triggers/webhook): Fire a Bento pipeline from any HTTP POST to /webhooks/{name}, with bearer-token authentication declared in daemon.yaml.
- [Schedule trigger](/triggers/schedule)
- [Manual trigger](/triggers/manual): Fire any Bento pipeline on demand with bento pipeline fire, and pass typed inputs to a pipeline that runs only on request.
- [Traces](/pipelines/traces)
- [Slack](/integrations/slack)
- [Public access](/public-access): Expose the Bento daemon to GitHub webhooks through a Cloudflare Quick Tunnel or Tailscale Funnel, and compare the two options.
- [Context engineering](/context-engineering): Assemble each coding agent prompt from personas, policies, skills, and pipeline instructions. Learn which file each instruction belongs in.
- [Best practices](/best-practices)
- [Troubleshooting](/troubleshooting)
- [Architecture](/architecture/vision)
- [Workspaces](/workspaces)
- [Authentication](/authentication)
- [Identity](/identity)
- [Security](/security)
- [References](/references)
- [Changelog](/changelog): Bento release history.
- [CLI reference](/cli/)
- [Setup](/cli/setup)
- [Secrets](/cli/secrets)
- [Lifecycle](/cli/lifecycle)
- [Sandbox image](/cli/image)
- [Sandboxes](/cli/sandbox)
- [Observability](/cli/observability)
- [Diagnostics](/cli/diagnostics)
- [Pipeline](/cli/pipeline)
- [Events](/cli/events)
- [Workbench](/cli/workbench)
- [Auth](/cli/auth)
- [Knowledge](/cli/knowledge)
- [Evals](/cli/evals)
- [Bento docs: run coding agents from version-controlled pipelines](/index): Bento runs coding agents from pipelines you keep in your repository. Declare the trigger, sandbox, skill, and guardrails in YAML.
- [Runtime wrapper](/architecture/runtime-wrapper)
- [Skill evolve](/architecture/skill-evolve)
-->

# Orchestration

An orchestrator decides how to do the work of a run. It can call the named agent directly, run tasks in parallel, or build a more complex pattern. Without an orchestrator, a pipeline runs its named agent directly.

If the steps of the work change from run to run, use an orchestrator. If each run does the same steps, use a direct agent.

## Enable orchestration

Add `orchestrator` to a pipeline. `auto` is the only strategy type.

```yaml
agent: reviewer
routes: [claude-high]
orchestrator:
  strategy:
    type: auto
```

The orchestrator runs as a direct API call in the daemon. The tasks that it dispatches run in sandboxes. Each route that the orchestrator uses must use the `claude` runtime.

A pipeline that sets `orchestrator` requires an `orchestrator` block in `daemon.yaml`. Config validation rejects the pipeline if that block is missing. The block supplies default routes. It does not enable orchestration for a pipeline that omits the field.

## Give guidance

To tell the orchestrator how to handle a pipeline, use `guidance`. The text is static. Bento does not render `event` or `args` templates in it.

```yaml
orchestrator:
  routes: [claude-low]
  strategy:
    type: auto
  guidance: |
    This is a single-shot notification. No fan-out needed.
    Delegate directly to the named agent and stop.
```

## Set the compute for each task

In generic mode, `task` and each entry in `parallel` accept an optional `class` from the registry of the active backend. A task with no `class` uses the class of the run.

Docker and Podman apply the class to the container of the task. Daytona keeps the size of the run, because all tasks share one sandbox.

An unknown class or route fails only that task. The other tasks in a parallel call continue.

## Use typed capabilities

A capability is one operation with a typed input and a typed output. To limit the orchestrator to work that you define, use capabilities. Bento validates each call and each result against the schemas.

Define each capability in a file under `.bento/capabilities/`:

```yaml
# .bento/capabilities/canon-review.yaml
name: canon_review
description: Review code against the engineering canon.
input:
  type: object
  properties:
    scope: { type: string, enum: [files, pull_request] }
    question: { type: string }
  required: [scope]
  additionalProperties: false
output:
  type: object
  properties:
    summary: { type: string }
    findings: { type: array, items: { type: object } }
  required: [summary, findings]
  additionalProperties: false
agent: reviewer
skill: agentic-review
routes: [claude-high, claude-backup]
secrets: none
timeout: 900
```

Register capabilities on the pipeline:

```yaml
orchestrator:
  strategy:
    type: auto
  guidance: Select the smallest capability that satisfies the request.
  capabilities:
    - canon_review
    - edit_pull_request
    - run_verification
  max_capability_calls: 5
```

In this mode, the orchestrator gets one tool for each capability and a `parallel` tool. It does not get the generic `task` tool. `max_capability_calls` defaults to `5`.

The daemon reads capabilities at startup. Restart the daemon after you change a capability.

## Control secrets

Every capability declares `secrets: none` or `secrets: injected`. Bento does not infer the value. The two values have these effects:

* A `secrets: none` capability gets no forge credentials, no git configuration, no credential mounts, and no `env:` secrets from the pipeline.
* A `secrets: injected` capability needs a parent run with injected secrets and a named grant from outside the model.

Do not put credentials in capability inputs or outputs. Use the pipeline `env:` manifest or credential mounts.

## Deliver the result

A capability returns data to the orchestrator. Bento does not send a capability result to GitHub.

An orchestrated run delivers through `result:` and `outputs:`, as a direct run does. See [result and outputs](/pipelines/config#result-and-outputs).

## Inspect a run

Bento records each dispatch in the trace of the run:

```bash
bento trace TRIGGER_ID
```

Replace `TRIGGER_ID` with the ID of the trigger, such as `trg_d990d0a0`.

For all fields, see the [orchestrator reference](/pipelines/config#orchestrator).
