Skip to content

Disable reflection after tool use #1024

@WorldInnovationsDepartment

Description

Description

Hello, Pydantic AI Team 👋

I’d like to propose a feature that allows for the creation of highly specialized agents that only execute tools without streaming textual output from LLM model (Disable reflection after tool use).

Use Case:

Consider a Search Agent that solely runs tool calls, passing their outputs to an Analyst Agent for processing. The Analyst Agent then collaborates with a Critique Agent to construct the final response. This setup enables modular and efficient agent interactions where streaming text from intermediate agents is unnecessary.

Current Limitation:

From my understanding, the framework does not currently support an agent that exclusively executes tools without attempting to stream a final response. I attempted to implement a workaround using .iter() and breaking the stream when an answer starts forming, but this approach was unsuccessful.

Questions & Contribution:

  1. Does this feature align with your roadmap or design philosophy?
  2. Is there a way to implement this behavior using an existing but undocumented approach?
  3. If this makes sense to you, I’d be happy to contribute a PR! Could you provide guidance on how best to implement it?

Looking forward to your thoughts! 🚀

References

I like how autogen managed to do this, their AssistantAgent (similar to Agent in pydantic-ai) has reflect_on_tool_use param and if it is False - FinalResult is just tool outputs.
Check the link to their docs for more details and check last block in diagram pls https://microsoft.github.io/autogen/dev/reference/python/autogen_agentchat.agents.html#autogen_agentchat.agents.AssistantAgent
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions