X-Agent (Cross-Agent)

Agents can discover, create, and invoke other agents in the same workspace to delegate tasks and collaborate.

Last verified Nov 23, 2026

How it works

Each agent container includes an MCP server called agents that exposes seven X-Agent tools. When an agent calls one, the request travels from the container back to the Gamut host over HTTP, authenticated with the container's proxy token. The host resolves which agent is calling, applies X-Agent Policies, and performs the operation on the caller's behalf.

The caller never communicates directly with the target agent's container. All orchestration flows through the host, which manages container lifecycle, session creation, message persistence, and policy enforcement.

X-Agent tools

list_agents

Discovers the other agents in the workspace. Returns each agent's slug, display name, and description; the calling agent is excluded. In auth mode, the list is filtered to agents the calling agent's owner has access to.

Call this before invoke_agent to find the slug of the agent you want to work with.

create_agent

Creates a new agent in the workspace. Accepts a name, an optional one-line description, and optional instructions that become the new agent's system prompt. Returns the new agent's slug, which invoke_agent accepts immediately.

Every create_agent call requires manual approval. There is no "always allow" policy for agent creation. In auth mode, the new agent inherits the ACL of the calling agent's owner.

invoke_agent

Sends a message to another agent. This is the primary tool for agent-to-agent delegation.

Parameters:

  • slug (optional): The target agent's slug (from list_agents). Leave it out to target the caller's own agent, for example to start a worker session or continue one of its own sessions. That needs no approval.
  • prompt: The message to send.
  • session_id (optional): An existing session to continue. If that session is in the middle of a turn, the message joins the turn, the way a user's follow-up does. If omitted, a new session starts on the target agent.
  • sync (optional): If true, the tool waits up to about 2 minutes for the target's turn to finish and returns its last message. If the target is still working after that, the call returns status running; the message was delivered, so the agent should poll with get_agent_session_transcript rather than invoke again. If false (the default), the tool returns immediately with status running.
  • attachments (optional): Up to 10 files from the caller's /workspace to send with the prompt.
  • model, effort, speed (optional): The model, effort level, and speed for a new session. Each defaults to the target agent's own setting. Not allowed together with session_id.

Returns: The session ID and status. In sync mode, the target agent's last message is included when the turn finished.

get_agent_sessions

Lists another agent's sessions, newest first. Each entry includes the session ID, name, creation time, last activity time, message count, and whether the session is currently running. Supports pagination via limit (default 50, max 200) and offset.

Use the returned session ID with get_agent_session_transcript to read a conversation, or with invoke_agent to send a follow-up.

get_agent_session_transcript

Reads the transcript of another agent's session. Returns a status line (running, idle, or awaiting_input) followed by the messages.

  • limit (optional): Return only the most recent N messages (limit: 1 is the agent's final message). Omit it for the whole view.
  • full_transcript (optional): By default the view shows spoken turns only, with tool calls, tool results, and thinking collapsed into a stub. Pass true to include tool names and results.
  • sync (optional): If the session is running, wait up to about 2 minutes for the turn to complete. If it's still running after that, the transcript so far is returned with status running.

To read its own past sessions, an agent uses /opt/gamut/bin/read-session.py instead of this tool.

download_agent_file

Downloads a file that another agent delivered in one of its sessions into the caller's workspace, under /workspace/downloads/x-agent/<agent>/. Existing files are never overwritten. Takes the agent's slug, the session ID, and the delivery ID shown by get_agent_session_transcript. Downloading follows the caller's read permission for that agent.

list_agent_members

Lists the people who are members of the caller's own agent, with each one's role (Owner, User, or Viewer), Gamut user ID, and email. When Gamut runs without sign-in there are no members to list.

Session tracking and provenance

When one agent invokes another, the resulting session on the target is tagged with metadata recording who started it, and its name defaults to "Invoked by [calling agent's name]" so cross-agent sessions are easy to spot in the session list.

  • invokedByAgentSlug: The slug of the agent that initiated the invocation.
  • createdByUserId: In auth mode, the user ID attributed to the invocation (inherited from the calling agent's owner).

One-hop invocation rule

Cross-agent invocation is limited to one hop: if Agent A invokes Agent B, Agent B cannot invoke Agent C (or Agent A) from that invoked session. This prevents runaway chains and circular invocations.

The host enforces the rule through session metadata: if the calling session has invokedByAgentSlug set, the invoke_agent call is rejected with an error explaining the constraint. The restriction applies only to invoked sessions; in sessions started directly by a user, the agent keeps full X-Agent capabilities.

Sessions on the caller's own agent

An agent can invoke its own agent, for example to start a worker session; no approval is needed. A session cannot send a message to itself: calling invoke_agent on the caller's own agent with the caller's own session_id is rejected.

Use cases

Manager-worker delegation

A manager agent receives a complex task, breaks it into subtasks, delegates each one with invoke_agent and sync=true, then synthesizes the results. A research agent might invoke a "Web Researcher" to gather information, a "Data Analyst" to process it, and a "Report Writer" to produce the final document.

Specialized agent collaboration

Agents with different capabilities can collaborate by reading each other's transcripts. A "Code Review" agent might read a "Developer" agent's sessions to understand what changed, then invoke the developer with feedback.

Dynamic agent creation

An agent can create new agents tailored to a task. A "Project Bootstrapper" might create specialized frontend, backend, and testing agents with customized instructions, then orchestrate work across them.

Session monitoring

A supervisory agent can use get_agent_sessions and get_agent_session_transcript to check on long-running tasks or compile status reports without sending messages that would trigger additional work.

Delivering sessions to the user

After invoking another agent, the caller can call deliver_session to surface the resulting session as a clickable card in the chat. The card links to the invoked session so the user can review the work. See Artifacts for the tool's parameters.

Further reading