-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
feature:coreneeds-more-infoWaiting for a reply/more info from the authorWaiting for a reply/more info from the authorquestionQuestion about using the SDKQuestion about using the SDK
Description
#==============================
# Agents as tool
#==============================
from agents import Agent, Runner
import asyncio
spanish_agent = Agent(
name="Spanish_agent",
instructions="You translate the user's message to Spanish",
)
french_agent = Agent(
name="French_agent",
instructions="You translate the user's message to French",
)
orchestrator_agent = Agent(
name="orchestrator_agent",
instructions=(
"You are a translation agent. You use the tools given to you to translate."
"If asked for multiple translations, you call the relevant tools."
),
tools=[
spanish_agent.as_tool(
tool_name="translate_to_spanish",
tool_description="Translate the user's message to Spanish",
),
french_agent.as_tool(
tool_name="translate_to_french",
tool_description="Translate the user's message to French",
),
],
)
result =Runner.run_sync(orchestrator_agent, input="Say 'Hello, how are you?' in Spanish.",run_config=config)
print(result.final_output)
OUTPUT:
I am sorry, I cannot fulfill this request. The tool returned an error. Please try again.
So why this issue occurs
Metadata
Metadata
Assignees
Labels
feature:coreneeds-more-infoWaiting for a reply/more info from the authorWaiting for a reply/more info from the authorquestionQuestion about using the SDKQuestion about using the SDK