Agent definition
An agent definition is the YAML under one name in the agents map. An agent name is any string without whitespace or / that does not start with .. Its runs_when entries start sessions, and each entry's receives rules choose the events that reach them. See runs_when.
Agent keys
| Key | Type | Default | Description |
|---|---|---|---|
root_path | string | /agents/<name> | The document folder that holds the agent's prompt, MCP config and skills. |
prompts | list of string | [] | The document paths that Hydra joins in order to form the agent's prompt. Each path must name a document that exists or that the same apply writes. |
environment | string | none | The environment key for a session when neither its runs_when entry nor the session names one. Set it to null to clear it. |
max_tries | integer | 3 | The maximum number of runs the server starts for one runs_when session. All of these runs serve the session's starting event. Chats do not use this key. |
max_subscriptions | integer | server default | The maximum number of subscriptions each live instance of the agent can hold. The minimum value is 1. |
adhoc | adhoc block | none | Controls when Hydra closes sessions that no runs_when entry started, such as chats, and when their subscriptions expire. Set it to null to clear it. |
is_default_agent | bool | false | When true, chats that name no agent go to this agent. Only one agent per organization can set it to true. |
is_default_slack_agent | bool | false | When true, Slack messages go to this agent. Only one agent per organization can set it to true. |
runtime | runtime block | none | The runtime settings for the agent's runs. |
model | model block | none | The agent's model policy. |
secrets | list of secret reference | none | Lists the secrets that the agent's runs receive. |
repo_permissions | list of grant | [] | Lists the repository grants that every session of the agent gets. |
runs_when | map of string to entry, or list of entry | none | The entries that start the agent's sessions. See runs_when. |
A later root_path change does not update prompts.
environments:
web:
mounts:
- type: bundle
target: web
source: { kind: repo, repo_name: acme/web }
secrets: [API_TOKEN]
agents:
swe:
prompts: [/agents/swe/prompt.md]
environment: web
max_tries: 3
max_subscriptions: 10
adhoc: { close_after_idle: 3d, subscriptions_expire_after: 30d }
secrets:
- { scope: org, name: API_TOKEN }
repo_permissions:
- { repo: acme/web, github: write, patches: approve }
runtime:
memory_request: 2Gi
memory_limit: 4Gi
hydra_prompt: include
model:
model_policy:
mode: replace
entries:
- { provider: claude }
runs_when:
implement:
lives_on: issue
where: self.status == "in-progress"
mode: headless
adhoc
Durations are a number followed by s, m, h or d, such as 3d. When you omit a key, Hydra turns off its behavior.
| Key | Type | Default | Description |
|---|---|---|---|
close_after_idle | duration | none | Hydra closes a session that stays idle this long. A new message reopens the session. |
subscriptions_expire_after | duration | none | Hydra deletes a closed session's subscriptions this long after the session closed. |
runtime
Set cpu_limit and cpu_request together, or neither. The same holds for memory_limit and memory_request.
| Key | Type | Default | Description |
|---|---|---|---|
cpu_limit | string | server default | Sets the CPU limit of a run, such as "2". |
cpu_request | string | server default | Sets the CPU request of a run. |
memory_limit | string | server default | Sets the memory limit of a run, such as 4Gi. |
memory_request | string | server default | Sets the memory request of a run. |
idle_timeout | timeout | server default | Sets the idle timeout of interactive sessions, as {kind: seconds, value: 3600} or {kind: infinite}. |
max_retries | integer | max_tries | Sets the maximum number of runs the server starts for one runs_when session. It overrides max_tries for runs. |
input_batching | input batching block | server default | Controls when an interactive session starts a turn on system events. |
hydra_prompt | include or omit | include | omit removes Hydra's built-in system prompt, the "Event updates" section and the "Session" block. Without them, the agent does not know how to use Hydra. |
auto_compact_window | integer | the agent's threshold | Sets the token count at which the agent's coding tool compacts the conversation. Claude Code accepts 100000 to 1000000 and clamps other values. |
disk_size | string | server default | Sets the size of a session's workspace volume, such as 20Gi. Hydra applies it when it creates the volume, and does not resize an existing one. |
input_batching requires all three keys. Each key takes a duration such as 30s, 15m or 2h. A user message starts a turn immediately.
| Key | Type | Default | Description |
|---|---|---|---|
debounce | duration | required | The turn starts once system events stop for this long. |
max_wait | duration | required | The turn starts no later than this after the first event. |
throttle | duration | required | The turn starts no sooner than this after the previous turn started. |
model
The agent's model holds one key, model_policy.
| Key | Type | Default | Description |
|---|---|---|---|
model_policy.mode | merge or replace | merge | merge appends the lower settings layers' entries. replace drops them. |
model_policy.entries | list of entry | [] | Lists {provider, model} pairs in failover order. Omit model to run the provider's default model. |
model_policy.strategy | fill-first | fill-first | fill-first takes the first entry whose provider has a usable credential. |
secrets
Each entry is a secret reference. The run receives the value under name. Hydra also accepts the {secrets: [...]} form.
| Key | Type | Default | Description |
|---|---|---|---|
scope | org or personal | required | org selects a shared secret of the organization. personal selects a secret of the user the run acts for. |
name | string | required | Names the secret. |
repo_permissions
Each level includes the ones before it. A session gets the grants of every settings layer: the agent's first, then the runs_when entry's, then the issue's.
githubis a setting. The last matching grant that namesgithubdecides the level, so a laterreadlowers an earlierwrite.patchesonly raises a level. The highest matching level wins.
| Key | Type | Default | Description |
|---|---|---|---|
repo | string | required | Names the repositories the grant covers, as owner/name, owner/* or *. |
github | read or write | none | read reads every matching repository the GitHub App is installed on, and makes a mounted one read-only. write also pushes to them and writes their pull requests. |
patches | read, write, approve or merge | none | A session needs write to create or update a patch, and approve to approve one. |
Without a grant, a session pushes to the repositories it mounts on GitHub and has patches: write on every repository. hydra config apply warns about a grant of patches: write or higher on a pattern whose github level is read, because the session cannot push the branches of its patches there.
Agent documents
These documents live in Hydra's document store under the agent's root_path. In a GitOps repository, they live under documents/.
| Path | Contents |
|---|---|
<root_path>/prompt.md | The agent's prompt body. Runs read it only when prompts lists it. |
<root_path>/mcp-config.json | The agent's MCP config. Hydra merges it with the environment's copy, and the environment's copy wins a conflict. |
<root_path>/skills/ | The agent's skills. Hydra merges them with the environment's skills, and the environment's copy wins a conflict. |
A run's prompt is the agent's prompts documents, then the entry's append_prompt documents, then the "Event updates" section, then the "Session" block.
Config changes and live sessions
- A config change reaches the live sessions of an interactive entry. A headless session gets it at the instance's next session, except for a change of a default
keyvalue. - A prompt change hard-resets an interactive singleton's session. A prompt change is an edit, addition, removal or reordering of the
promptsandappend_promptdocuments. The run first gets areset_pendingwarning. The session resets at the first turn that answers it, or at the deadline, 15 minutes later by default. The next run starts at once on the new prompt, without the earlier conversation. - The server never hard-resets a session on a node. A change of only the prompt and the environment leaves it as it is. The instance's next session gets the new prompt and environment. A prompt change together with another change soft-resets it.
- Any other change soft-resets the session. Examples are a singleton's environment or its image,
runtime,model,secrets, the MCP config, skills andon_behalf_of. The server waits for the next turn that is not interrupted and leaves no message waiting. It ends the run, or resets at once when no run is live. The next message or event starts a new run on the new settings and resumes the conversation. Its first turn starts with a notice that names what changed. - A change of only
lives_on,where,receives,max_liveormax_triesresets nothing. - A change of only who may message the session, such as
participants, updates the session in place, and the run continues. - Each reset keeps the session's id and its chat log.