Skip to content

Allow raw tool call arguments to be pre-processed in case schema validation fails #3008

@warmwind

Description

@warmwind

Question

When I set the output type of an agent to a TypedDict, sometimes the AI returns incorrect JSON (see attached screenshot).

Image

I’d like to know if there’s a way to preprocess or adjust the agent’s response after the AI generates it but before it’s passed to the final_result tool.

  • Does output_validator handle this kind of preprocessing?
  • Or do I need to use stream_responses and validate_response_output manually to intercept and fix responses?

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions