-
Notifications
You must be signed in to change notification settings - Fork 251
Description
We are implementing a Multi-Agent System using a standard AI SDK with a hierarchical architecture ("Orchestrator Pattern"). The system consists of a Parent Agent (Orchestrator) that delegates tasks to specialized Sub-Agents (e.g., a Data Service Agent, an Issue Tracking Agent).
The Problem:
We are observing a critical loss of derived context (specifically resolved entities like user_id, dates, or semantic_intent) during the hand-off execution phase from the Parent Agent to the Sub-Agent.
While the Parent Agent successfully plans the execution and resolves the necessary parameters in its internal "Chain of Thought" (CoT), this context is not persisted or effectively shared when the Sub-Agent session is instantiated.
Observed Behavior:
- User Request: "Show my profile."
- Parent Agent (Orchestrator): correctly identifies the scope and filters:
- Reasoning: "I need to fetch profile data for User ID
12345." - Plan: Call
DataSubAgentwith filterid=12345.
- Reasoning: "I need to fetch profile data for User ID
- Handoff/Execution: The system triggers the
DataSubAgent. - Sub-Agent Failure:
- The Sub-Agent receives the generic directive but loses the resolved parameter (
id=12345). - Result: Sub-Agent executes a generic query (e.g.,
SELECT * FROM entities) instead of a filtered one. - Output: Returns a list of ALL records instead of the specific authenticated user's record.
- The Sub-Agent receives the generic directive but loses the resolved parameter (
Technical Diagnosis (Hypothesis):
The issue lies in how the Conversation State or Tool Arguments are serialized and passed to the Sub-Agent within the framework.
- The internal reasoning of the Parent Agent is treated as "ephemeral thought" and is excluded from the prompt context sent to the Sub-Agent.
- Unless arguments are explicitly forced into the function call signature, the Sub-Agent starts with a "fresh" or "shallow" context, unaware of the constraints established by the Parent.
Steps to Reproduce:
- Authenticate as User A.
- Ask the Orchestrator: "Show my active items."
- Observe logs: Orchestrator correctly resolves "my" -> "User A".
- Observe execution: Sub-Agent queries the API without the ownership filter, returning items for all users or failing due to volume.