Skip to content

feat: update structured_output tool name to reduce user confusion #534

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dbschmigelski
Copy link
Member

Description

Based on the uploaded file and conversation history, here's the suggested pull request description:

Problem:
Users are experiencing confusion when using structured output functionality. When using:

agent(tools=[...])
agent.structured_output()

The tools from the main agent are incrementing normally, but the structured output functionality creates an ephemeral agent that always shows "Tool #1: {model name}" in the output. This is causing confusion since this tool is actually the structured output tool.

For example for a grocery buying agent constructed using

class GroceryAgent():
    @tool
     def create_grocery_list(request: str) -> Grocery:
         agent = Agent()
         response = agent(request)
         return agent.structured_output(Grocery, response)

class PurchaseAgent():
    @tool
     def purchase_grocery_list(request: str) -> Purchase:
         agent = Agent()
         response = agent(request)
         return agent.structured_output(Purchase, response)

final_agent = Agent(tools=[GroceryAgent().create_grocery_list, PurchaseAgent().purchase_grocery_list])
final_agent(....)
Let me help review and schedule your order using the available tools.

Tool #1: create_grocery_list
Let me determine which groceries to buy
Tool #1: Grocery

Tool #2: purchase_grocery_list
I'll purchase the groceries now
Tool #1: Purchase

...

Solution:
This PR updates the tool naming convention by appending "OutputStructurer" to the model name (e.g., "GroceryOutputStructurer" instead of just "Grocery"). This change makes it clearer to users which tool is handling the structured output functionality and reduces confusion around tool numbering.

This should result in something slightly more obvious regarding where the tool is coming from like

Let me help review and schedule your order using the available tools.

Tool #1: create_grocery_list
Let me determine which groceries to buy
Tool #1: GroceryOutputStructurer

Tool #2: purchase_grocery_list
I'll purchase the groceries now
Tool #1: PurchaseOutputStructurer

Type of Change

Other (please describe): This should not be breaking as the interface has not changed but this change modifies the internal Agent's tool name

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant