pydantic-contracts
Skill10 starsChanged 5 months agoMITView on GitHub
Any data crossing HTTP, A2A, MCP, or a queue is a frozen Pydantic v2 model. Each agent's tools.py defines its own pair. Examples:
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- a2a-loopback-testsSkill
- aca-bicepSkill
- aks-helmSkill
- copilot-sdk-gpt55Skill
- maf-agent-skeletonSkill
- mcp-server-skeletonSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 72
No bare dict / Any in tool signatures.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: Pydantic Contracts (process boundary)
Any data crossing HTTP, A2A, MCP, or a queue is a frozen Pydantic v2 model.
A2A envelope (in src/shared/server.py)
from pydantic import BaseModel, ConfigDict, Field
class InvokeRequest(BaseModel):
model_config = ConfigDict(frozen=True, extra="forbid")
run_id: str = Field(min_length=1, max_length=64)
goal: str = Field(min_length=1, max_length=4000)
context: dict[str, str] = Field(default_factory=dict)
class InvokeResponse(BaseModel):
model_config = ConfigDict(frozen=True)
run_id: str
output: str
tool_calls: list[str] = Field(default_factory=list)Orchestrator workflow contracts
class Goal(BaseModel):
model_config = ConfigDict(frozen=True)
goal: str
sku: str | None = None
store_id: str | None = None
class Plan(BaseModel):
model_config = ConfigDict(frozen=True)
stock_view: str
price_view: str
po_view: str
shipping_view: str
summary: strPer-agent tool inputs
Each agent's tools.py defines its own pair. Examples:
class StockQuery(BaseModel):
model_config = ConfigDict(frozen=True)
sku: str
locations: list[str]
class LocationStock(BaseModel):
model_config = ConfigDict(frozen=True)
location: str
on_hand: int
reorder_point: int
class StockReport(BaseModel):
model_config = ConfigDict(frozen=True)
sku: str
items: list[LocationStock]Rules
extra="forbid"on all request models.frozen=Trueon all models — agents and tools should never mutate inputs.- No bare
dict/Anyin tool signatures.# noqa: ANN401only with a written reason.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

