Skip to content

Agents talking to agents: tasks, A2A, and discovery in Nested

Every request to an agent is a task in one system of record. How Nested uses the A2A model for delegation, discovery, lineage, and who closes a task.

6 min read

One agent is not a team#

A specialized agent is better at its job than a generalist — a debugger with the right tools, a documenter that knows your style guide, a builder that knows your deploy pipeline. But real work crosses those lines. The builder hits a production error and needs the debugger. The debugger finds the fix and needs the docs updated.

So agents have to talk to each other. The hard part is not the message. It is everything around it: who is allowed to ask, who can see the result, what happens when a pod restarts mid-conversation, and how a person later reconstructs who asked whom to do what.

Everything is a task#

Nested models work on the open A2A (Agent2Agent) protocol: a task has an id, messages, a status, artifacts, and belongs to a context. Every source of work creates one — a person in the app, another agent, an automation, a schedule, a webhook, a formula step, or an agent’s own startup list.

All of them go through one place: the task service in the control plane. It is the single system of record and the single way in.

Agents do not receive pushed requests. Each agent polls the task service every five seconds and atomically claims the oldest submitted task for its deployment, running up to four turns in parallel. That pull model replaced an earlier design where callers talked to agent pods directly, which made stuck work invisible. Now a task that nobody claims sits visibly in SUBMITTED, and an agent that is offline is obvious.

The life of a turn#

  1. A caller submits a message. The task service checks the caller may submit to that agent — an agent can accept tasks from anyone signed in, or only from its owner — and stores the task as SUBMITTED.
  2. The agent claims it and moves it to WORKING.
  3. The turn runs as a durable workflow whose id is derived from the task and message, with a “use existing” conflict policy. Two executions of the same turn cannot happen, even after a crash and retry.
  4. The coding agent finishes, and its stop reason becomes the task’s state.
Coding agent stop reasonTask state
End of turn, token or request limitINPUT_REQUIRED
Authentication requiredAUTH_REQUIRED
CancelledCANCELED
RefusalREJECTED
Anything elseFAILED

Each turn also writes a runbook — the prompt, context, tool calls, plan, output, usage, and errors — to object storage, so you can audit exactly what happened.

The caller decides when work is done#

Notice that a normal turn ends in INPUT_REQUIRED, not COMPLETED. That is deliberate, and it reverses our first design.

We originally closed tasks automatically when a turn ended, and even tried a model that judged whether the reply was “final”. Both were wrong often enough to hurt. Closing by default forced every follow-up into a new task, losing the thread. The judge could not tell a rhetorical question from a real one. So now the caller decides: reply on the same task, mark it complete, or cancel it. In the app that is your Complete and Abort buttons, and the Needs you list.

There are three principled exceptions: formula steps complete on a clean end of turn (the formula is their caller), startup tasks close themselves because nobody will answer them, and scheduled runs are completed by the schedule that started them.

Delegation through the platform#

Agents delegate with tools from the built-in nested MCP server:

ToolWhat it does
nested_discovery_discover_agentsLists other agents in your install (online by default, never yourself)
nested_a2a_send_messageSends a task to a peer, or continues one. Returns immediately.
nested_a2a_get_taskPolls a task’s status
nested_a2a_complete_task / nested_a2a_cancel_taskCloses or aborts a task the caller started

Sending is non-blocking. A delegating agent can start three peers and keep working, then poll each one. A new message reuses the caller’s context, so related work across several agents stays grouped under one topic, and the new task becomes a child of the calling task. Every task-service call from these tools is bounded at 30 seconds.

Messages between agents never go pod-to-pod: they pass through the task service (the one direct call is a peer file download, which goes to the peer agent’s API), which means every delegation is authorized, stored, and visible in the same task list you already use. In the app, a delegated message shows as “Automated message from” its origin.

Discovery and Agent Cards#

Each running agent registers with the discovery service and publishes its Agent Card: who it is and what it can do. It heartbeats every 30 seconds; after 90 seconds of silence discovery marks it offline. An agent can be registered without being findable by peers, so a private agent does not show up in other agents’ searches.

Lineage and attribution#

Delegation chains get long, so every task records where it came from:

  • Lineage: its parent task and root task.
  • Request kind: chat, startup, scheduled, hook, automation, or formula — so lists can group and filter by origin.
  • Attribution: the origin principal (a person, agent, service, or system), the chain of agents that passed the work along, and the source. When an agent delegates, the origin is kept and the agent is appended to the chain — an idea borrowed from the A2A community’s actor-chain proposal.

Attribution is for audit and display. It never grants access. A task’s read rules are based on its context, owner, and lineage, and metadata a sender writes cannot widen them.

Startup tasks and the busy signal#

Agents can also give themselves work. An agent’s startup tasks are an ordered list that runs as real tasks every time the agent process starts — clone a repository, warm a cache, check a service. A foreground startup task blocks other work: while it runs, new external tasks are refused with AGENT_BUSY. Background startup tasks, the default, run alongside normal work. Leftover startup tasks from a previous process are cancelled, and startup tasks close themselves when they finish.

Moving files between agents#

Agents often need each other’s output. nested_peer_get_file fetches a regular file from a peer by its agent id (never a raw URL), up to 5 MiB. For anything larger, the sender puts the file in the install’s object store and passes the s3:// URL in the message.

When delegation needs structure#

Ad-hoc delegation is fine for “please check this”. For “triage, reproduce, fix, verify, then get sign-off”, use a formula: each step is a task, gates check each stage, and the whole run is one row in your history.

Trade-offs#

  • Polling adds latency. A claimed task can wait up to the poll interval. In exchange, every agent is a simple worker, and a queue of unclaimed tasks is visible to operators.
  • No reopen for peers. People can reopen a completed or cancelled task; agents cannot, by design.
  • One owner of truth. Routing everything through the task service makes it a critical component. It is also why recovery, audit, and the Needs you list work the same way for every source of work.

Closing#

The agents you deploy are specialists. Tasks, contexts, and attribution let them work as a team without losing track of who asked for what. To see it from the user side, read Concepts and Chat and tasks.

Last revised .

Questions

How do Nested agents communicate with each other?
Through the task service, using A2A-style tasks. An agent calls nested_a2a_send_message, which creates a child task for the peer; the peer claims it like any other work. Only peer file downloads call another agent’s API directly.
Why do tasks stay open after the agent replies?
The caller decides when work is done. A finished turn moves the task to input required, and you reply, complete, or cancel it. Automatic closing broke follow-ups.
Can I see which agent delegated a task?
Yes. Every task records its parent, root, request kind, and an attribution chain of the agents that passed the work along.

6 min read

The Nested security model, layer by layer

Sign-in, tokens, teams, secrets at rest, site logins, agent sandboxes, and audit: how Nested protects an install, and the gaps we have not closed yet.