mirror of
https://github.com/pydantic/pydantic-ai-harness.git
synced 2026-07-21 02:45:34 +00:00
Add structured output to quick start example (#202)
* Add structured output and print to quick start example Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add print(result.output) to code mode examples Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Simplify quick start example — remove structured output Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
87e722e61c
commit
bd5cc7c1b7
@@ -51,6 +51,7 @@ agent = Agent(
|
||||
)
|
||||
|
||||
result = agent.run_sync('Rank the open PRs on pydantic/pydantic-harness by thumbs-up reactions. Which 5 should we merge first?')
|
||||
print(result.output)
|
||||
```
|
||||
|
||||
[`MCP`](https://ai.pydantic.dev/capabilities/#provider-adaptive-tools) (from the core `pydantic-ai` package) connects your agent to any MCP server -- here, [GitHub's official MCP server](https://github.com/github/github-mcp-server).
|
||||
|
||||
@@ -36,6 +36,7 @@ def convert_temp(fahrenheit: float) -> float:
|
||||
return round((fahrenheit - 32) * 5 / 9, 1)
|
||||
|
||||
result = agent.run_sync("What's the weather in Paris and Tokyo, in Celsius?")
|
||||
print(result.output)
|
||||
```
|
||||
|
||||
The model writes code like:
|
||||
@@ -151,6 +152,8 @@ from pydantic_ai import Agent
|
||||
from pydantic_harness import CodeMode
|
||||
|
||||
agent = Agent.from_file('agent.yaml', custom_capability_types=[CodeMode])
|
||||
result = agent.run_sync('...')
|
||||
print(result.output)
|
||||
```
|
||||
|
||||
Pass `custom_capability_types` so the spec loader knows how to instantiate `CodeMode`. You can also pass arguments in the YAML:
|
||||
|
||||
Reference in New Issue
Block a user