﻿# Pydantic AI streaming can finish before later tool calls

Pydantic AI run_stream treats the first matching output as final; later tool calls and their feedback require deliberate end strategy and streaming interface choices.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/guide-pydantic-ai-stream-first-output/
Language: en

## Notice when text arrives before evidence work

A model response begins with report text and also contains a request to inspect another source. In a streaming application, showing that text can look like the start of a completed answer. Pydantic AI's [agent guide](https://pydantic.dev/docs/ai/core-concepts/agent/) explains that `run_stream` treats the first output matching the configured output type as final. That recognition can precede additional tool calls in the same response.

## Set the end strategy deliberately

The [agent API](https://pydantic.dev/docs/ai/api/pydantic-ai/agent/) describes early, graceful and exhaustive tool-completion strategies. Under an explicitly selected early strategy, later function work can be skipped when final output succeeds. Other strategies have different execution ordering and completion behavior. Read the installed version and method's effective setting rather than infer it from a general default description. The operational requirement is whether the remaining tools must execute, not merely whether text has appeared.

## Separate tool execution from model feedback

The streaming guide notes that graceful or exhaustive completion of dangling calls does not send their results back to the model after the streamed output has already been considered final. A source inspection running is therefore different from its evidence influencing that answer. If report acceptance requires the model to incorporate the inspection, completing the tool after final output is insufficient. Define the required feedback path before marking streamed prose as the accepted research artifact.

## Use graph-complete events for continued reasoning

The [output guide](https://pydantic.dev/docs/ai/core-concepts/output/) points to `run_stream_events` or graph iteration when the application must keep processing tools and model turns through completion. Raw event handling requires the application to assemble presentation appropriately. Early text can be shown as progress while the final accepted result remains tied to graph completion. [Tool observations](/journal/learn-codex-tool-observation/) should distinguish a tool request, its execution and the later response that actually used its result.

## Review acceptance after the relevant final event

For a response containing both text and tool calls, inspect the effective strategy, executed calls and subsequent model turns. [Task contracts](/journal/learn-codex-task-contract/) establish whether additional source evidence is mandatory. The interface can then explain why an early text candidate is still provisional or why a deliberately bounded streaming path has ended. This prevents a finished text stream from being mistaken for proof that every requested source was inspected and incorporated into the answer.
