Skip to content
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

feat: select errors that will be caught when raised within a tool #5488

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

Conversation

wistuba
Copy link
Contributor

@wistuba wistuba commented Feb 11, 2025

Conversation starter to agree on the implementation. When we are aligned, I'll add tests.

Why are these changes needed?

Not every tool error should be returned to the agent. This change allows to cherry-pick which exceptions we want to share with the agent.

Related issue number

Closes: #5274

Checks

@@ -37,6 +37,9 @@ def description(self) -> str: ...
@property
def schema(self) -> ToolSchema: ...

@property
def return_errors(self) -> tuple[type[Exception], ...] | type[Exception]: ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename it return_error_types? This makes it align with the return_type property that already exists.

Let's also add API doc comment to each field of Tool and BaseTool as a good Samaritan 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also add API doc comment to each field of Tool and BaseTool as a good Samaritan

Not sure what you mean by this. Do you want me to add docstrings to every function in Tool/BaseTool?

@wistuba
Copy link
Contributor Author

wistuba commented Feb 12, 2025

I think there was some confusion on the Issue regarding what this feature should do. Do we want to keep adding the error types to the Tool or is there now a preference to add it to the agent? Former has the advantage that you can deal differently with each tool, latter allows you to only define it once and it is applied automatically for every tool.

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.

To support configuring how errors are handled in tools.
2 participants