Skip to content

docs: custom output extraction #817

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 1 commit into
base: main
Choose a base branch
from

Conversation

jleguina
Copy link

@jleguina jleguina commented Jun 5, 2025

In deep agent workflows, each sub‐agent automatically performs an LLM step to summarize its tool calls before returning to its parent. This leads to:

  1. Excessive latency: every nested agent invokes the LLM, compounding delays.
  2. Loss of raw tool data: summaries may strip out details the top‐level agent needs.

We discovered that Agent.as_tool(...) already accepts an (undocumented) custom_output_extractor parameter. By providing a callback, a parent agent can override what the sub‐agent returns e.g. hand back raw tool outputs or a custom slice so that only the final agent does summarization.


This PR adds a “Custom output extraction” section to the Markdown docs under “Agents as tools,” with a minimal code example.

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