# PyCharter

> Runtime data-contract enforcement for Python, and a toolkit FOR AI agents.
> One Pydantic-native contract validates API objects, Kafka streams, and ETL
> batches in-process — and grounds, checks, and guards AI agents that produce
> or evolve that data.

PyCharter is the toolkit an AI agent reaches for when it must be correct about
your data. The same versioned contract that validates a record at runtime is
the schema an agent is handed, the validator that checks its output, and the
vocabulary that tells it what a field means — over MCP with zero install.

## For AI agents
- Guide: docs/guides/pycharter-for-ai-agents.md
- MCP integration: docs/guides/agent-integration-mcp.md
- Serve tools over MCP: `pip install pycharter[ai]` then `pycharter agent serve`
- Key APIs: `Validator.to_llm_schema()`, `Validator.to_tool_schema(provider)`,
  `ValidationResult.to_agent_feedback()`, `pycharter.agent.repair_loop`,
  `pycharter.contrib.agents.contract_tool` / `contract_output_model`.
- MCP read tools: list_contracts, fetch_contract_schema, validate_record
  (returns agent_feedback), sketch_contract, diff_contract_candidate,
  lint_contract, fetch_concept_pack, explain_field.

## Core docs
- Start here: docs/getting-started/start-here.md
- Concepts: docs/getting-started/concepts.md
- Artifacts use `api_version: pycharter.io/v2`.
- Comparisons: docs/getting-started/comparisons.md

## Guarantees
- The stateless core never calls an LLM; `[ai]` is optional.
- Agent tool calls are policy-filtered; mutations are fail-closed and
  approval-gated.
