Skip to content

Critical Context Propagation Failure in "Agent-as-Sub-Agent" #607

@fedorovychh

Description

@fedorovychh

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:

  1. User Request: "Show my profile."
  2. Parent Agent (Orchestrator): correctly identifies the scope and filters:
    • Reasoning: "I need to fetch profile data for User ID 12345."
    • Plan: Call DataSubAgent with filter id=12345.
  3. Handoff/Execution: The system triggers the DataSubAgent.
  4. 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.

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:

  1. Authenticate as User A.
  2. Ask the Orchestrator: "Show my active items."
  3. Observe logs: Orchestrator correctly resolves "my" -> "User A".
  4. Observe execution: Sub-Agent queries the API without the ownership filter, returning items for all users or failing due to volume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions