Skip to content

Build Agents on a shared base

MCPAPIIntermediate~10 min

Give several Agents the same tasks, processes and know-how by keeping them once, in a base Agent, and making each of the others extend it. Each Agent then inherits everything in the base's system memory except its boot prompt, always the current version, and you write into each Agent only what it does differently. You set it up by asking your agent. Agent inheritance explains how it works.

Before you start

  • You manage the child Agent. Setting its base is for whoever manages it. Managing the base isn't enough.
  • Your organization may use the base. A base in your own organization needs nothing more, unless its grant was revoked. A base in another organization needs your organization's grant for it, and an Agent you own as a person needs your subscription to a public base.
  • You have both Agents' URNs, such as hrn:agent:acme.com:engineer (an Agent's id works too). These tools don't look an Agent up by its name, so a bare name like engineer is refused. If you only know the name, ask your agent to find the URN first: "Find the URN of the engineer Agent."

Decide what goes in the base

Put in the base what every child should share: the common tasks, the processes the whole team runs, reference nodes everyone reads. Leave in each child only what it does differently, at the same loc as the base's node it replaces. The nearest node to the child wins at a shared loc, and it replaces the base's node whole.

For example, if engineer holds tasks:open-pr, tasks:review and processes:release, and backend-engineer reviews differently, give backend-engineer its own tasks:review. It inherits the other two.

Boot prompts are never inherited, so each child keeps its own.

Set the base

Ask your agent:

Make hrn:agent:acme.com:backend-engineer extend hrn:agent:acme.com:engineer.

It calls hadron_agent_set_base, and the answer names the Agent and its new base. Nothing is copied: the child reads through the base from now on, so a later change to the base reaches the child on its next read.

A base may have a base of its own, up to 10 Agents in a chain, counting the child. Asking again with another Agent changes the base; the old chain's nodes drop out and the new chain's come in on the next read. The child's own nodes are never touched.

Check what it inherited

List the tasks of hrn:agent:acme.com:backend-engineer, and say which ones it inherits.

The answer lists each task once. An inherited one names the base it comes from and gives a Read through address in the child's own system memory. See See an Agent's tasks and processes.

Clear the base

Clear the base of hrn:agent:acme.com:backend-engineer.

The answer says Base: none, and the child keeps only its own nodes. Clear the base of every live child before you retire a base: retiring an Agent that a live Agent still extends is refused with AGENT_IN_USE.

Point an Agent at its tasks and processes indexes

An Agent's task list and process list include an index's entries with their triggers: each index edge's name, the situation in which to run that task or process. To give an Agent its own indexes, name the two index nodes:

Set the tasks index of hrn:agent:acme.com:backend-engineer to
hrn:node:acme.com:backend-engineer-system:tasks, and its processes index to
hrn:node:acme.com:eng-team-shared:processes.

Your agent calls hadron_agent_set_index_refs, and the answer shows both pointers, each a URN or none.

  • A pointer you don't mention stays as it is. Ask to clear one, and it's cleared.
  • Each index must be a node you can read.
  • The child doesn't need its own indexes to inherit: its bases' indexes still give their tasks and processes triggers, and every task in its effective system memory is listed either way.

If it's refused

Each refusal changes nothing.

Code What it means What to do
AGENT_NOT_FOUND The child or the base doesn't exist or is retired, the child is one you can't read, or the base isn't public and your organization holds no licence to it, so you may not see it. An Agent you can't read is never confirmed to exist. Check the URN, or ask for access.
FORBIDDEN You can read the child, but you don't manage it. Ask whoever manages the child.
AGENT_ORG_GRANT_REQUIRED The base belongs to another organization, and yours has no grant for it. Ask the base's organization for a grant.
AGENT_ORG_GRANT_INACTIVE Your organization's grant for the base is no longer active (revoked or expired). No call restores it: a second grant for the same organization and base is refused with this same code, and extending never reactivates it. Extend a different base, or raise it with the base's organization.
AGENT_SUBSCRIPTION_REQUIRED The child is yours as a person, and you don't subscribe to the base. Subscribe to the base first.
AGENT_BASE_CYCLE The base is the child itself, or already extends it. Pick a base outside the child's own family tree.
AGENT_BASE_CHAIN_TOO_LONG A chain through this Agent, its own or one below it, would hold more than 10 Agents. Shorten a chain first, or extend an Agent nearer the top.
NODE_NOT_FOUND An index node you named doesn't exist, or you can't read it. Check the node's URN and your access to its memory.

Without an agent

The same changes are GraphQL setAgentBase and setAgentIndexRefs, with the same gate and refusals. The CLI's raw GraphQL command makes them:

hadron api 'mutation {
  setAgentBase(ref: "hrn:agent:acme.com:backend-engineer", baseRef: "hrn:agent:acme.com:engineer") {
    urn
    extendsAgentId
  }
}'

baseRef: null clears the base. For setAgentIndexRefs, an argument you leave out keeps that pointer, and null clears it. Dedicated CLI commands, hadron agent set-base and hadron agent update --tasks-index / --processes-index, have merged and ship in the next CLI release.