Skip to content

Possible to truncate tool call outputs before sending back to model? #2168

@JoeBerg8

Description

@JoeBerg8

I'm using the chat completions API and the version 0.6.1 of the agents sdk.

I want to know if it's possible to truncate a ToolCallOutputItem before the agents sdk sends it back to the model. The motivation here is to manage context token budgets. Occasionally, some of my data retrieval tools will return large amount of data and this can get me close to the context limit of a model over the course of a long conversation It would be great if I could truncate tool call outputs before the tool outputs get sent to the model. I'm aware of summarization techniques but that's not always what I want to do - sometimes a simple truncation would be better for my use case.

I'm happy to take a stab at a PR for this somewhere in the ToolCallOutputItem class in agents/items.py if it's not currently possible.

Thanks in advance!

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