Documentation

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

KeyTypeDefaultDescription
root_pathstring/agents/<name>The document folder that holds the agent's prompt, MCP config and skills.
promptslist 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.
environmentstringnoneThe environment key for a session when neither its runs_when entry nor the session names one. Set it to null to clear it.
max_triesinteger3The 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_subscriptionsintegerserver defaultThe maximum number of subscriptions each live instance of the agent can hold. The minimum value is 1.
adhocadhoc blocknoneControls 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_agentboolfalseWhen true, chats that name no agent go to this agent. Only one agent per organization can set it to true.
is_default_slack_agentboolfalseWhen true, Slack messages go to this agent. Only one agent per organization can set it to true.
runtimeruntime blocknoneThe runtime settings for the agent's runs.
modelmodel blocknoneThe agent's model policy.
secretslist of secret referencenoneLists the secrets that the agent's runs receive.
repo_permissionslist of grant[]Lists the repository grants that every session of the agent gets.
runs_whenmap of string to entry, or list of entrynoneThe 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.

KeyTypeDefaultDescription
close_after_idledurationnoneHydra closes a session that stays idle this long. A new message reopens the session.
subscriptions_expire_afterdurationnoneHydra 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.

KeyTypeDefaultDescription
cpu_limitstringserver defaultSets the CPU limit of a run, such as "2".
cpu_requeststringserver defaultSets the CPU request of a run.
memory_limitstringserver defaultSets the memory limit of a run, such as 4Gi.
memory_requeststringserver defaultSets the memory request of a run.
idle_timeouttimeoutserver defaultSets the idle timeout of interactive sessions, as {kind: seconds, value: 3600} or {kind: infinite}.
max_retriesintegermax_triesSets the maximum number of runs the server starts for one runs_when session. It overrides max_tries for runs.
input_batchinginput batching blockserver defaultControls when an interactive session starts a turn on system events.
hydra_promptinclude or omitincludeomit 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_windowintegerthe agent's thresholdSets the token count at which the agent's coding tool compacts the conversation. Claude Code accepts 100000 to 1000000 and clamps other values.
disk_sizestringserver defaultSets 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.

KeyTypeDefaultDescription
debouncedurationrequiredThe turn starts once system events stop for this long.
max_waitdurationrequiredThe turn starts no later than this after the first event.
throttledurationrequiredThe turn starts no sooner than this after the previous turn started.

model

The agent's model holds one key, model_policy.

KeyTypeDefaultDescription
model_policy.modemerge or replacemergemerge appends the lower settings layers' entries. replace drops them.
model_policy.entrieslist of entry[]Lists {provider, model} pairs in failover order. Omit model to run the provider's default model.
model_policy.strategyfill-firstfill-firstfill-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.

KeyTypeDefaultDescription
scopeorg or personalrequiredorg selects a shared secret of the organization. personal selects a secret of the user the run acts for.
namestringrequiredNames 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.

  • github is a setting. The last matching grant that names github decides the level, so a later read lowers an earlier write.
  • patches only raises a level. The highest matching level wins.
KeyTypeDefaultDescription
repostringrequiredNames the repositories the grant covers, as owner/name, owner/* or *.
githubread or writenoneread 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.
patchesread, write, approve or mergenoneA 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/.

PathContents
<root_path>/prompt.mdThe agent's prompt body. Runs read it only when prompts lists it.
<root_path>/mcp-config.jsonThe 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 key value.
  • A prompt change hard-resets an interactive singleton's session. A prompt change is an edit, addition, removal or reordering of the prompts and append_prompt documents. The run first gets a reset_pending warning. 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 and on_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_live or max_tries resets 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.