Skip to content

docs: document Agent run metadata, runtime exit_conditions, SearchableToolset notes, and MockChatGenerator#11873

Draft
julian-risch wants to merge 4 commits into
v3from
docs/v3-simple-doc-updates-3
Draft

docs: document Agent run metadata, runtime exit_conditions, SearchableToolset notes, and MockChatGenerator#11873
julian-risch wants to merge 4 commits into
v3from
docs/v3-simple-doc-updates-3

Conversation

@julian-risch

@julian-risch julian-risch commented Jul 5, 2026

Copy link
Copy Markdown
Member

Related Issues

Proposed Changes:

  • feat!: Track step_count, token_usage and tool_call_counts in Agent's State #11427Agent docs: the result dictionary now lists the auto-populated step_count, token_usage, and tool_call_counts outputs, with a new "Run Metadata" section explaining that they are readable mid-run by tools via inputs_from_state, are outputs only, and are reserved state_schema keys. The State page mentions "Reserved keys" covering all Agent-managed keys: the three run-metadata keys plus the hook-facing continue_run, tools, and hook_context.
  • fix: Various fixes to Agent around using SearchableToolset #11557Agent / SearchableToolset docs: exit_conditions is now described as evaluated at runtime, so conditions can name tools loaded later . Duplicate tool names are detected at the start of each agent step, and a new "Warm-up" section on the SearchableToolset page notes that constructing an Agent no longer warms up the toolset (warm-up happens via Agent.warm_up() or at run time).
  • fix: Refactor SearchableToolset and fix serialization of catalog=Toolset #11549SearchableToolset docs: warm_up() raises a ValueError when the catalog contains tools with duplicate names. Folded into the new "Warm-up" section.
  • feat: add MockChatGenerator #11708 — New MockChatGenerator page covering the four response modes (fixed, cycling, response_fn, echo default), model / meta / streaming_callback parameters, and usage examples. Added to the sidebar and the Generators overview table.

How did you test it?

  • The MockChatGenerator examples and the documented token_usage / step_count / tool_call_counts output shapes were executed against the v3 code.

Notes for the reviewer

Checklist

🤖 Generated with Claude Code

…hatGenerator

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
haystack-docs Ready Ready Preview, Comment Jul 7, 2026 10:38am

Request Review

…d state keys

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@julian-risch julian-risch changed the title docs: document Agent run metadata, runtime exit_conditions, and MockChatGenerator docs: document Agent run metadata, runtime exit_conditions, SearchableToolset notes, and MockChatGenerator Jul 5, 2026
Removed redundant wording and improved clarity in the overview section of MockChatGenerator documentation.
- `system_prompt`: A plain string or Jinja2 template used as the system message for every run. If the template contains Jinja2 variables, those variables become additional inputs to `run()`.
- `user_prompt`: A Jinja2 template appended to the user-provided messages on each run. Template variables become additional inputs to `run()`. Use `required_variables` to enforce which variables must be provided.
- `exit_conditions`: List of conditions that cause the agent to stop. Use `”text”` to stop when the LLM replies without a tool call, or a tool name to stop once that tool has been executed. Defaults to `[“text”]`.
- `exit_conditions`: List of conditions that cause the agent to stop. Use `”text”` to stop when the LLM replies without a tool call, or a tool name to stop once that tool has been executed. Defaults to `[“text”]`. Exit conditions are evaluated at runtime rather than validated at initialization, so a condition can name a tool that is only loaded later — for example, a tool passed at runtime via `run(tools=...)` or one discovered by a [`SearchableToolset`](../../tools/searchabletoolset.mdx).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The addition could also be left out.

`chat_generator` is the only mandatory parameter — an instance of a Chat Generator that supports tools. All other parameters are optional.

- `tools`: A list of tool or toolset instances the agent can call. Supported types: [`Tool`](../../tools/tool.mdx), [`ComponentTool`](../../tools/componenttool.mdx), [`PipelineTool`](../../tools/pipelinetool.mdx), [`MCPTool`](../../tools/mcptool.mdx), [`Toolset`](../../tools/toolset.mdx), [`MCPToolset`](../../tools/mcptoolset.mdx), [`SearchableToolset`](../../tools/searchabletoolset.mdx).
- `tools`: A list of tool or toolset instances the agent can call. Supported types: [`Tool`](../../tools/tool.mdx), [`ComponentTool`](../../tools/componenttool.mdx), [`PipelineTool`](../../tools/pipelinetool.mdx), [`MCPTool`](../../tools/mcptool.mdx), [`Toolset`](../../tools/toolset.mdx), [`MCPToolset`](../../tools/mcptoolset.mdx), [`SearchableToolset`](../../tools/searchabletoolset.mdx). Tool names must be unique; duplicate names are detected at the start of each agent step, before the chat generator is called.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The addition could also be left out.

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