Multi-Agent Memory
Understand memory boundaries when agents delegate to other agents.
When an agent uses another agent through asTool(...), memory still follows the active prompt request.
const supportAgent = new AgentBuilder("support", model)
.instructions("Return support triage notes.")
.build();
const coordinator = new AgentBuilder("coordinator", model)
.memory(memoryStore)
.tool(supportAgent.asTool({ name: "ask_support_agent" }))
.build();
await coordinator.session("thread_123").prompt("Triage this incident.").send();In this setup, memoryStore saves the coordinator session transcript:
| Message | Saved in coordinator memory |
|---|---|
| User prompt | Yes |
| Coordinator assistant tool call | Yes |
Final ask_support_agent tool result | Yes |
| Coordinator final answer | Yes |
| Support agent internal text deltas or turns | No |
The specialist result is saved as the parent tool result because that is the content the coordinator model receives on the next turn. The specialist's internal run is not appended to the coordinator session as separate user/assistant messages.
Streaming Agent Tools
Streaming does not change memory behavior:
const coordinator = new AgentBuilder("coordinator", model)
.memory(memoryStore)
.tool(supportAgent.asTool({ name: "ask_support_agent", stream: true }))
.build();With stream: true, the caller can see child-agent progress as agent_tool_event stream events, but memory still stores only transcript messages and final tool results. Use Event Store if you need to persist those nested runtime events.
Specialist Memory
If a specialist needs its own durable history, configure memory on that specialist and run it through a session from application code:
const supportAgent = new AgentBuilder("support", model)
.memory(memoryStore)
.build();
const response = await supportAgent
.session("support_thread_123")
.prompt("Continue support investigation.")
.send();agent.asTool(...) prompts the child agent directly, so it does not automatically create a child session. For manager/specialist workflows, keep the coordinator session as the durable user-facing conversation, and use explicit specialist sessions only when the specialist has its own long-lived thread.
