Skip to content

docs: add ToolLoopAgent testing example#12656

Open
sleitor wants to merge 1 commit intovercel:mainfrom
sleitor:docs/testing-tool-loop-agent
Open

docs: add ToolLoopAgent testing example#12656
sleitor wants to merge 1 commit intovercel:mainfrom
sleitor:docs/testing-tool-loop-agent

Conversation

@sleitor
Copy link

@sleitor sleitor commented Feb 17, 2026

What?

Add a testing example for ToolLoopAgent to the Testing docs.

Why?

The testing page covers generateText, streamText, generateObject, and streamObject, but has no example for ToolLoopAgent. This was reported in #12616.

How?

Added a section showing how to use MockLanguageModelV3 with mockValues to simulate a multi-step tool loop:

  1. Step 1: Mock model returns a tool-call (weather tool)
  2. Tool executes: Returns mock weather data
  3. Step 2: Mock model returns final text response

The example demonstrates the key pattern for testing agents: providing multiple mock responses via mockValues to simulate the tool loop.

Fixes #12616

Add a testing example for ToolLoopAgent that demonstrates how to use
MockLanguageModelV3 with mockValues to simulate a multi-step tool loop:
first step returns a tool call, tool executes, second step returns
final text.

Fixes vercel#12616
@tigent tigent bot added ai/core documentation Improvements or additions to documentation labels Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide an example for ToolLoopAgent in testing.

1 participant