pydantic-ai
AI Agent Framework, the Pydantic way
Source#
- Repository: pydantic/pydantic-ai
- Last source update: 2026-04-05
- Last verified: 2026-04-05
Tags#
Integration notes#
Framework-level abstraction; derive bounded worker contracts from concrete tasks and APIs in docs/examples.
worker.md example#
Starter worker.md contract mapped from this registry entry. Copy this file and adapt schemas, constraints, and statuses for your task.
---
id: pydantic-ai-repo-derived-worker
name: pydantic-ai Repo-Derived Worker
version: 1.0.0
source_registry_url: https://worker.md/registry/pydantic-ai/
source_repository: https://github.com/pydantic/pydantic-ai
repository_default_branch: main
repository_language: Python
repository_license: MIT
repository_updated_at: 2026-04-05
worker_mode: agent-orchestration-worker
derivation_method: github_repository_metadata_plus_raw_readme
derivation_confidence: 0.9
derived_on: 2026-04-05
tags:
- agent-framework
- genai
- llm
- pydantic
- python
---
# pydantic-ai Repo-Derived Worker
## Repo-derived summary
- Registry summary: AI Agent Framework, the Pydantic way
- Repository description: AI Agent Framework, the Pydantic way
- Stars (snapshot): 16,100
- Primary language: Python
- Worker mode classification: agent-orchestration-worker
## Extracted from
- https://github.com/pydantic/pydantic-ai
- https://github.com/pydantic/pydantic-ai/blob/main/README.md
- https://docs.pydantic.dev
- https://docs.pydantic.dev/latest/
- https://ai.pydantic.dev/#tools-dependency-injection-example
## Evidence notes (from repository text)
- README summary paragraph: ### Pydantic AI is a Python agent framework designed to help you quickly, confidently, and painlessly build production grade applications and workflows with Generative AI.
- ### Pydantic AI is a Python agent framework designed to help you quickly, confidently, and painlessly build production grade applications and workflows with Generative AI.
- Yet despite virtually every Python agent framework and LLM library using Pydantic Validation, when we began to use LLMs in https://pydantic.dev/logfire, we couldn't find anything that gave us the same feeling.
- We built Pydantic AI with one simple aim: to bring that FastAPI feeling to GenAI app and agent development.
- Enables you to systematically test and https://ai.pydantic.dev/evals the performance and accuracy of the agentic systems you build, and monitor the performance over time in Pydantic Logfire.
- # Define a very simple agent including the model to use, you can also set the model when running the agent.
## Installation hints found in README
- No explicit package installation command detected in README text.
## worker.md contract (derived starter)
Purpose: Execute one orchestrated agent task as a bounded worker step.
### Input schema
```json
{
"type": "object",
"additionalProperties": false,
"required": [
"run_id",
"task",
"context"
],
"properties": {
"run_id": {
"type": "string"
},
"task": {
"type": "string"
},
"context": {
"type": "object"
}
}
}
```
### Output schema
```json
{
"type": "object",
"additionalProperties": false,
"required": [
"run_id",
"status",
"result"
],
"properties": {
"run_id": {
"type": "string"
},
"status": {
"type": "string",
"enum": [
"ok",
"retryable_error",
"invalid_request",
"invalid_output"
]
},
"result": {
"type": "object"
}
}
}
```
### Constraints
- timeout_seconds: 30
- max_attempts: 2
- idempotency_key: run_id
- status_enum: [ok, retryable_error, invalid_request, invalid_output]
- notes: adapt to concrete APIs/classes documented in this repository before production use
## How this should be used
1. Treat this file as a repo-derived starter profile, not a claim of an official repository API contract.
2. Replace schemas with exact interfaces from code/docs you adopt.
3. Keep execution bounded and auditable using worker protocol constraints.
How to use#
- Save this as a worker spec file (for example:
pydantic-ai-my-task.worker.md). - Replace the input/output schemas and purpose with your real bounded task.
- Enforce schema validation + timeout + retry policy in your runtime before production use.
Citation#
Reference URL: https://worker.md/registry/pydantic-ai/
Source URL: https://github.com/pydantic/pydantic-ai