Skip to content
Discussion options

You must be logged in to vote

The issue with relying on agents to report their own caller is that LLMs can hallucinate names. Here's a more reliable pattern:

Solution: Track Caller in Shared State

# Before routing to Archiving agent, record the source
state = {
    "current_task": {
        "id": "task_123",
        "source_agent": "classifier_node_A",  # Set by the router
        "routed_via": "edge_priority_high"
    }
}

# In Archiving agent or its tools:
def archive_task(data: dict) -> str:
    caller = state["current_task"]["source_agent"]
    edge = state["current_task"]["routed_via"]
    # Now you have deterministic caller info
    ...

Why this works:

  • The state is written by your routing logic, not the LLM
  • No …

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by subbu4github
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@alexmercer-ai
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants