Agent Foundry
All Problems

#83. Agent Handoff with Context

MediumMulti-AgentMemory

The Problem

You have a two-agent flow: a sales agent helps the customer choose a plan, then hands off to an onboarding agent to set up the account. The problem is that when the handoff happens, the onboarding agent has no knowledge of what was discussed during the sales conversation. It asks the customer to repeat their plan choice, team size, and preferences. Your task is to preserve the full conversation context during the handoff so the onboarding agent can pick up seamlessly.

Examples

Example 1

User input (to sales): I'm interested in the Pro plan for my team of 10.

User input (to onboarding): Great, I'd like to set up my account now.

Current (bad) output: The onboarding agent asks: "Welcome! What plan would you like? How many team members?" — repeating questions already answered.

Expected (good) output: The onboarding agent says: "Welcome! I see you've chosen the Pro plan for 10 team members. Let's get your account set up. First, I'll need your company email…"

Example 2

User input (to sales): I need the Enterprise plan with SSO and custom integrations.

User input (to onboarding): Let's proceed with setup.

Current (bad) output: Onboarding has no idea about the Enterprise plan or SSO requirement and starts with generic setup steps.

Expected (good) output: Onboarding acknowledges the Enterprise plan, SSO requirement, and custom integrations, then walks through the relevant setup process.

Your Task

Fix the starter code so that:

  • The conversation history from the sales agent is passed to the onboarding agent during handoff.
  • The onboarding agent knows what was discussed and does not ask the user to repeat information.
  • The handoff uses an explicit mechanism (not accidental shared state).
  • The transition feels seamless to the user.

Evaluation

Submissions are checked for the following:

  • Conversation context preserved: The full conversation history from Agent A is available to Agent B after handoff.
  • No repeated questions: Agent B does not ask the user to repeat information already provided to Agent A.
  • Seamless handoff experience: The transition between agents feels continuous to the user.
  • Explicit handoff mechanism: The handoff is done through an explicit mechanism, not accidental state sharing.

Constraints

  • The full conversation history must be preserved during handoff
  • Agent B must be aware of what Agent A discussed with the user
  • You may not ask the user to repeat information after a handoff
  • The handoff mechanism must be explicit, not implicit
Starter Code
from agents import Agent, Runner

sales_agent = Agent(
    name="Sales Agent",
    instructions="You are a sales agent. Help customers choose the right product plan.",
)

onboarding_agent = Agent(
    name="Onboarding Agent",
    instructions="You are an onboarding specialist. Help new customers set up their account.",
)

# BUG: When sales hands off to onboarding, conversation context is lost
# TODO: Preserve conversation history during the handoff

# Simulate a multi-turn conversation
result = Runner.run_sync(sales_agent, "I'm interested in the Pro plan for my team of 10")
print("Sales:", result.final_output)

# User is ready to onboard — but onboarding agent has no context
result = Runner.run_sync(onboarding_agent, "Great, I'd like to set up my account now")
print("Onboarding:", result.final_output)
Open in Google Colab
Evaluation Criteria0/4