Building Pydantic AI Agents
docling-project/docling
Patterns and tested examples for building agents with Pydantic AI: tools, capabilities, structured output, dependency injection, hooks, YAML specs, streaming and testing.
Configuration module patterns for LlamaFarm. An agent skill from llama-farm/llamafarm.
$ npx skills add llama-farm/llamafarm --skill config-skills -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install llama-farm/llamafarm config-skills --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/llama-farm/llamafarm.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/config-skills .claude/skills/config-skills && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "config-skills" agent skill from https://github.com/llama-farm/llamafarm/tree/main/.claude/skills/config-skills into .claude/skills/config-skills/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "config-skills", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/llama-farm/llamafarm/tree/main/.claude/skills/config-skillsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add llama-farm/llamafarm --skill config-skills -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install llama-farm/llamafarm config-skills --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/llama-farm/llamafarm.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/config-skills .agents/skills/config-skills && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "config-skills" agent skill from https://github.com/llama-farm/llamafarm/tree/main/.claude/skills/config-skills into .agents/skills/config-skills/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "config-skills", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add llama-farm/llamafarm --skill config-skills -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install llama-farm/llamafarm config-skills --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/llama-farm/llamafarm.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/config-skills .cursor/skills/config-skills && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "config-skills" agent skill from https://github.com/llama-farm/llamafarm/tree/main/.claude/skills/config-skills into .cursor/skills/config-skills/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "config-skills", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/llama-farm/llamafarm.git --path .claude/skills/config-skills--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add llama-farm/llamafarm --skill config-skills -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install llama-farm/llamafarm config-skills --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/llama-farm/llamafarm.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/config-skills .gemini/skills/config-skills && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "config-skills" agent skill from https://github.com/llama-farm/llamafarm/tree/main/.claude/skills/config-skills into .gemini/skills/config-skills/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "config-skills", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install llama-farm/llamafarm config-skillsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add llama-farm/llamafarm --skill config-skills -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/llama-farm/llamafarm.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/config-skills .github/skills/config-skills && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "config-skills" agent skill from https://github.com/llama-farm/llamafarm/tree/main/.claude/skills/config-skills into .github/skills/config-skills/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "config-skills", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add llama-farm/llamafarm --skill config-skills -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install llama-farm/llamafarm config-skills --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/llama-farm/llamafarm.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/config-skills .opencode/skills/config-skills && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "config-skills" agent skill from https://github.com/llama-farm/llamafarm/tree/main/.claude/skills/config-skills into .opencode/skills/config-skills/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "config-skills", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
config-skillsConfiguration module patterns for LlamaFarm. An agent skill from llama-farm/llamafarm.
Config Skills is an agent skill from llama-farm/llamafarm. Configuration module patterns for LlamaFarm. Covers Pydantic v2 models, JSONSchema generation, YAML processing, and validation.
Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files (for example `jsonschema.md` and `pydantic.md`).
It works with Pydantic and Python. The repository describes itself as: Deploy any AI model, agent, database, RAG, and pipeline locally or remotely in minutes. The licence is Apache-2.0.
4 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 6244d46. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
ReadGrepGlobFrom allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
uvnxruffFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use uv, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Config Skills loads about 1.3k tokens when it runs. Until then it costs about 35 tokens; SKILL.md has 243 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from llama-farm/llamafarm at commit 6244d46, republished under its Apache-2.0 licence (© llama-farm). 243 words, ~1,278 tokens.
.claude/skills/config-skills/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.Specialized patterns and best practices for the LlamaFarm configuration module (config/).
The config module provides YAML/TOML/JSON configuration loading with JSONSchema validation:
| File | Purpose |
|---|---|
datamodel.py | Generated Pydantic v2 models from JSONSchema |
schema.yaml | Source JSONSchema with $ref references |
compile_schema.py | Dereferences $ref to create schema.deref.yaml |
generate_types.py | Generates Python types via datamodel-codegen |
validators.py | Custom validators beyond JSONSchema capabilities |
helpers/loader.py | Config loading, saving, and format detection |
helpers/generator.py | Template-based config generation |
This module follows Python conventions from the shared skills:
| Topic | Link | Key Relevance |
|---|---|---|
| Patterns | python-skills/patterns.md | Pydantic v2, dataclasses |
| Typing | python-skills/typing.md | Type hints, constrained types |
| Testing | python-skills/testing.md | Pytest fixtures, temp files |
| Errors | python-skills/error-handling.md | Custom exceptions |
| Security | python-skills/security.md | Path traversal prevention |
| Checklist | Description |
|---|---|
| pydantic.md | Pydantic v2 configuration patterns, nested models, constraints |
| jsonschema.md | JSONSchema generation, dereferencing, validation |
ConfigDict, Field, constrained types$ref dereferencing via jsonrefruamel.yaml for comment-preserving read/writedatamodel-codegen for schema-to-PydanticThe datamodel.py file is auto-generated from JSONSchema:
# Generated by datamodel-codegen from schema.deref.yaml
from pydantic import BaseModel, ConfigDict, Field, conint, constr
class Database(BaseModel):
model_config = ConfigDict(extra="forbid")
name: constr(pattern=r"^[a-z][a-z0-9_]*$", min_length=1, max_length=50)
type: Type
config: dict[str, Any] | None = Field(None, description="Database-specific configuration")JSONSchema draft-07 cannot express all constraints. Custom validators extend validation:
def validate_llamafarm_config(config_dict: dict[str, Any]) -> None:
"""Validate constraints beyond JSONSchema (uniqueness, references)."""
# Check for duplicate prompt names
prompt_names = [p.get("name") for p in config_dict.get("prompts", [])]
duplicates = [name for name in prompt_names if prompt_names.count(name) > 1]
if duplicates:
raise ValueError(f"Duplicate prompt set names: {', '.join(set(duplicates))}")Configuration files preserve user comments when modified:
from ruamel.yaml import YAML
from ruamel.yaml.comments import CommentedMap
def _get_ruamel_yaml() -> YAML:
yaml_instance = YAML()
yaml_instance.preserve_quotes = True
yaml_instance.indent(mapping=2, sequence=4, offset=2)
return yaml_instanceconfig/
├── pyproject.toml # UV-managed dependencies
├── schema.yaml # Source JSONSchema with $ref
├── schema.deref.yaml # Dereferenced schema (generated)
├── datamodel.py # Pydantic models (generated)
├── compile_schema.py # Schema compilation script
├── generate_types.py # Type generation script
├── validators.py # Custom validation beyond JSONSchema
├── validate_config.py # CLI validation wrapper
├── __init__.py # Public API exports
├── helpers/
│ ├── loader.py # Config loading/saving
│ └── generator.py # Template-based generation
├── templates/
│ └── default.yaml # Default config template
└── tests/
├── conftest.py # Shared fixtures
└── test_*.py # Test modulesWhen modifying the configuration schema:
schema.yaml (or referenced schemas like ../rag/schema.yaml)nx run generate-types to compile and generate typesvalidators.py if new cross-field constraints are neededuv run pytest config/tests/# Generate types from schema
nx run generate-types
# Validate a config file
uv run python config/validate_config.py path/to/llamafarm.yaml --verbose
# Run tests
uv run pytest config/tests/ -v
# Lint and format
ruff check config/ --fix
ruff format config/© llama-farm, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 2 other files in .claude/skills/config-skills of llama-farm/llamafarm.
Open the folder on GitHubat commit 6244d46
Config Skills next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Config Skills this skillllama-farm/llamafarm | 836 | — | ~1.3k | Automated safety check: Pass | Apache-2.0 | |
| Building Pydantic AI Agentsdocling-project/docling | 69k | — | ~2.8k | Automated safety check: Pass | MIT | |
| Fastcrudbenavlabs/fastcrud | 1.6k | — | ~5k | Automated safety check: Pass | MIT | |
| Prompt Engineering Patternswshobson/agents | 40k | — | ~1.3k | Automated safety check: Pass | MIT | |
| A2ui Generate Pydantic Modelsa2ui-project/a2ui | 17k | — | ~2.3k | Automated safety check: Pass | Apache-2.0 | |
| Migrating Agno To Pydantic AIpydantic/pydantic-ai | 21k | — | ~1.8k | Automated safety check: Pass | MIT |
docling-project/docling
Patterns and tested examples for building agents with Pydantic AI: tools, capabilities, structured output, dependency injection, hooks, YAML specs, streaming and testing.
benavlabs/fastcrud
A skill your agent uses when building or modifying CRUD endpoints with FastCRUD (the fastcrud PyPI package) in a FastAPI project — covers FastCRUD, crudrouter, EndpointCreator, FilterConfig…
wshobson/agents
Reference for designing and tuning production LLM prompts: few-shot examples, chain-of-thought, structured outputs, templates and system prompts.
a2ui-project/a2ui
Automated generator for strongly typed Pydantic v2 data models and basic catalogs across any A2UI protocol version (v0.8, v0.9, v0.9.1, v1.0, etc.).
pydantic/pydantic-ai
Migrate Python Agno applications to Pydantic AI and, only when needed, Pydantic AI Harness.
timothywarner-org/claude-code
Scaffold production-ready Python MCP servers using FastMCP. An agent skill from timothywarner-org/claude-code.
llama-farm/llamafarm
Analyze the current session and propose improvements to skills.
llama-farm/llamafarm
Guidelines for creating temporary files in system temp directory.
llama-farm/llamafarm
CLI best practices for LlamaFarm. An agent skill from llama-farm/llamafarm.
llama-farm/llamafarm
Comprehensive code review for diffs. An agent skill from llama-farm/llamafarm.
llama-farm/llamafarm
Commit changes, push to GitHub, and open a PR. An agent skill from llama-farm/llamafarm.
llama-farm/llamafarm
Best practices for the Common utilities package in LlamaFarm.
Configuration module patterns for LlamaFarm. An agent skill from llama-farm/llamafarm. Config Skills is an agent skill from llama-farm/llamafarm. Configuration module patterns for LlamaFarm.
Run `npx skills add llama-farm/llamafarm --skill config-skills -a claude-code`. Or copy the skill folder (.claude/skills/config-skills in llama-farm/llamafarm) into .claude/skills/config-skills in your project. Claude Code loads it when a task matches its description.
Run `npx skills add llama-farm/llamafarm --skill config-skills -a codex`. Or copy the skill folder (.claude/skills/config-skills in llama-farm/llamafarm) into .agents/skills/config-skills in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add llama-farm/llamafarm --skill config-skills -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/config-skills, .gemini/skills/config-skills, .github/skills/config-skills and .opencode/skills/config-skills in your project.
Going by SKILL.md and its folder, Config Skills needs the command-line tools its instructions call (uv, nx and ruff). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Read, Grep, Glob.
SKILL.md contains no URLs. Its commands use uv, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Config Skills is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.3k tokens (SKILL.md is roughly 5.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Config Skills: Building Pydantic AI Agents (docling-project/docling, 69k stars), Fastcrud (benavlabs/fastcrud, 1.6k stars), Prompt Engineering Patterns (wshobson/agents, 40k stars) and A2ui Generate Pydantic Models (a2ui-project/a2ui, 17k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
llama-farm (a GitHub organization) maintains it in llama-farm/llamafarm, which has 836 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on June 10, 2026.
Source: llama-farm/llamafarm on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.