docs: clarify end_strategy values in agent spec#6140
Merged
Conversation
VectorPeak
marked this pull request as ready for review
June 30, 2026 01:40
hramezani
approved these changes
Jun 30, 2026
Collaborator
|
Thanks @VectorPeak |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This keeps agents and spec-driven readers from making decisions from stale docs and carrying an outdated
end_strategyassumption into their context.What Problem This Solves
docs/agent-spec.mddocumentedend_strategyas accepting only'early'or'exhaustive'.The actual
EndStrategytype isLiteral['early', 'graceful', 'exhaustive'], andAgentSpec.end_strategydefaults to'graceful'. Leaving the agent spec docs behind the code can mislead readers and spec-driven agent/context configuration into treating the default strategy as unavailable.Recommendation
This should be updated because
agent-spec.mdacts as the declarative contract readers use when configuring agents from specs. If it omits the current default, downstream examples, generated configs, or agent-context setup can incorrectly treat'graceful'as invalid or unsupported, creating avoidable context/configuration confusion even though the runtime already supports it.Change
'graceful'to theend_strategyvalues listed in theAgentSpecfield table.Evidence
pydantic_ai_slim/pydantic_ai/_agent_graph.pydefinesEndStrategy = Literal['early', 'graceful', 'exhaustive'].pydantic_ai_slim/pydantic_ai/agent/spec.pysetsend_strategy: EndStrategy = 'graceful'.Validation
rg -n "end_strategy|EndStrategy|graceful|exhaustive" docs/agent-spec.md pydantic_ai_slim/pydantic_ai/_agent_graph.py pydantic_ai_slim/pydantic_ai/agent/spec.pygit diff --checkuv run pre-commit run no-rst-syntax --files docs/agent-spec.mdwas attempted, butpre-commitis not installed in the current environment (program not found).Checklist