-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"agent.as_tool" not working with Gemini #243
Labels
question
Question about using the SDK
Comments
Could you share the error (and ideally reproducible code) |
Below code is working on my sideimport asyncio
from agents import Agent, ItemHelpers, MessageOutputItem, Runner, trace
spanish_agent = Agent(
name="spanish_agent",
instructions="You translate the user's message to Spanish",
handoff_description="An english to spanish translator",
model=model
)
french_agent = Agent(
name="french_agent",
instructions="You translate the user's message to French",
handoff_description="An english to french translator",
model=model
)
italian_agent = Agent(
name="italian_agent",
instructions="You translate the user's message to Italian",
handoff_description="An english to italian translator",
model=model
)
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 in order."
"You never translate on your own, you always use the provided 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",
),
italian_agent.as_tool(
tool_name="translate_to_italian",
tool_description="Translate the user's message to Italian",
),
],
model=model
)
async def main():
msg = input("Hi! What would you like translated, and to which languages? ")
orchestrator_result = await Runner.run(orchestrator_agent, msg)
print(f"\n\nFinal response:\n{orchestrator_result.final_output}")
if __name__ == "__main__":
asyncio.run(main()) you can check this link : https://github.com/panaversity/learn-agentic-ai/blob/main/00_openai_agents/08_agents_as_tool/agents_as_tools.ipynb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have created 3 agents and passed them to an orchestrator agent as tools. But when orchestrator tries to call these agents (tools), it says an error occurred.
Did anybody else face similar issue with "agent.as_tool"??
(I am using google gemini 2.0 flash)
The text was updated successfully, but these errors were encountered: