Pattern

Global variable contract for connected agents

Values passed between a parent agent and connected agents through global variables that arrive empty or never come back.

Last reviewed 8 July 2026

The pattern

Values return from a connected agent to its parent only through global variables. Treat that path like an interface: document a naming convention and an ownership contract. The contract states which agent writes each variable, which agent reads it, and when. In the connected agent, set each return value twice: Global.x for the parent and Topic.x for the connected agent itself. Use a dedicated end-of-plan topic to fill the return values from tool outputs. Only the parent talks to the user; delegations should instruct: "Return your findings only. Don't reply to the user."

When to use it

  • Whenever a parent agent needs results back from a connected agent.
  • When the connected agent's variable picker does not see a global variable you defined.
  • Before you split one agent into a parent with connected agents.

Steps

  1. List every value that crosses the parent-child boundary, in both directions.
  2. Agree on one naming convention for these global variables, for example a shared prefix.
  3. Document for each variable: who writes it, who reads it, and when it must be filled.
  4. In the connected agent, set each return value twice: Global.x and Topic.x.
  5. Add a dedicated end-of-plan topic in the connected agent that fills the global return values from tool outputs.
  6. Test the round trip and verify every global variable arrives filled.