Skip to content

How to use Handoff and MCP together? #459

Closed
@Grjia

Description

@Grjia

from agents import Agent, Runner
import asyncio

spanish_agent = Agent(
name="Spanish agent",
instructions="You only speak Spanish.",
mcp_servers=[mcp_server],
)

english_agent = Agent(
name="English agent",
instructions="You only speak English",
mcp_servers=[mcp_server],
)

triage_agent = Agent(
name="Triage agent",
instructions="Handoff to the appropriate agent based on the language of the request.",
handoffs=[spanish_agent, english_agent],
)

async def main():
result = await Runner.run(triage_agent, input="Hola, ¿cómo estás?")
print(result.final_output)
# ¡Hola! Estoy bien, gracias por preguntar. ¿Y tú, cómo estás?

if name == "main":
asyncio.run(main())

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-more-infoWaiting for a reply/more info from the authorquestionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions