Fix docs-parity gate and OutputGuard retry test after guardrails merge (#348)

* docs: link shipped guardrails package from README (fix docs-parity CI)

* test: use FunctionModel for OutputGuard retry test (survives pyai #6403 text-recovery removal)
This commit is contained in:
David SF
2026-07-10 20:39:58 -05:00
committed by GitHub
parent 5ab8dd3d81
commit d13cdae9cb
2 changed files with 8 additions and 3 deletions
+2 -2
View File
@@ -169,8 +169,8 @@ We studied leading coding agents, agent frameworks, and Claw-style assistants to
| | **Runtime authoring** | Let an agent author, validate, and load real capabilities at runtime | :white_check_mark: [Docs](pydantic_ai_harness/experimental/authoring/) (experimental) | |
| | **Task tracking** | Track tasks, subtasks, and dependencies | :memo: [#65](https://github.com/pydantic/pydantic-ai-harness/issues/65) | [pydantic-ai-todo](https://github.com/vstorm-co/pydantic-ai-todo) (vstorm‑co) |
| | **Teams** | Multi-agent teams with shared state and message bus | :memo: [#195](https://github.com/pydantic/pydantic-ai-harness/issues/195) | [pydantic-deep](https://github.com/vstorm-co/pydantic-deepagents) (vstorm‑co) |
| **Safety & guardrails** | **Input guardrails** | Validate user input before the agent run starts | :construction: [PR #182](https://github.com/pydantic/pydantic-ai-harness/pull/182) | [pydantic-ai-shields](https://github.com/vstorm-co/pydantic-ai-shields) (vstorm‑co) |
| | **Output guardrails** | Validate model output after the run completes | :construction: [PR #182](https://github.com/pydantic/pydantic-ai-harness/pull/182) | [pydantic-ai-shields](https://github.com/vstorm-co/pydantic-ai-shields) (vstorm‑co) |
| **Safety & guardrails** | **Input guardrails** | Validate user input before the agent run starts | :white_check_mark: [Docs](pydantic_ai_harness/guardrails/) | [pydantic-ai-shields](https://github.com/vstorm-co/pydantic-ai-shields) (vstorm‑co) |
| | **Output guardrails** | Validate model output after the run completes | :white_check_mark: [Docs](pydantic_ai_harness/guardrails/) | [pydantic-ai-shields](https://github.com/vstorm-co/pydantic-ai-shields) (vstorm‑co) |
| | **Cost/token budgets** | Enforce token and cost limits per run | :construction: [PR #182](https://github.com/pydantic/pydantic-ai-harness/pull/182) | [pydantic-ai-shields](https://github.com/vstorm-co/pydantic-ai-shields) (vstorm‑co) |
| | **Tool access control** | Block tools or require approval before execution | :construction: [PR #182](https://github.com/pydantic/pydantic-ai-harness/pull/182) | [pydantic-ai-shields](https://github.com/vstorm-co/pydantic-ai-shields) (vstorm‑co) |
| | **Async guardrails** | Run validation concurrently with model requests | :construction: [PR #182](https://github.com/pydantic/pydantic-ai-harness/pull/182) | [pydantic-ai-shields](https://github.com/vstorm-co/pydantic-ai-shields) (vstorm‑co) |
+6 -1
View File
@@ -13,6 +13,8 @@ from pydantic import BaseModel
from pydantic_ai import Agent
from pydantic_ai.capabilities import CapabilityOrdering, Instrumentation
from pydantic_ai.exceptions import UnexpectedModelBehavior
from pydantic_ai.messages import ModelMessage, ModelResponse, TextPart
from pydantic_ai.models.function import AgentInfo, FunctionModel
from pydantic_ai.models.test import TestModel
from pydantic_ai.output import OutputContext
from pydantic_ai.tools import RunContext
@@ -114,7 +116,10 @@ class TestOutputGuard:
return GuardResult.retry('Try again without personal data.')
return GuardResult.allow()
agent = Agent(TestModel(custom_output_text='answer'), capabilities=[OutputGuard(guard=guard)])
def answer(messages: list[ModelMessage], info: AgentInfo) -> ModelResponse:
return ModelResponse(parts=[TextPart('answer')])
agent = Agent(FunctionModel(answer), capabilities=[OutputGuard(guard=guard)])
result = await agent.run('hello')
assert result.output == 'answer'