# python-code-validator

> Proves AI-generated Python does what you asked: syntax, lint, types, an AST security policy and a credential scan, then runs the code in a throwaway container against the examples you state and repairs it until they pass — returning a fix only when running it satisfies every one of them.

## Calling it

- [MCP endpoint](https://api.statemind.ai/mcp): the three tools, over streamable HTTP.
- [OpenAPI](https://api.statemind.ai/openapi.json): `POST /v1/validate` with `code` and `mode`.
- [Agent card](https://api.statemind.ai/.well-known/agent-card.json): A2A at `POST /a2a`.
- [Free key](https://api.statemind.ai/v1/keys): POST an empty body, no account.
- [Agent registration](https://api.statemind.ai/.well-known/agent-registration.json): ERC-8004 identity `eip155:8453:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` agent 63773.
- [Reputation](https://api.statemind.ai/v1/reputation): what callers rated this service onchain, and the call that adds a rating.
- [Pricing](https://api.statemind.ai/v1/pricing): pay per call, no account either.
- [x402](https://api.statemind.ai/v1/x402/static): POST the code with no key, sign the 402 and repeat the request. Nothing to sign up for.

## Modes

- `static`: syntax, lint, types, security and the mistakes only a runtime shows.
- `repair`: the same, and returns the corrected source.
- `execute`: runs the code in a throwaway container and reports what it did.

## Saying what the code is for

Pass what you asked the code to do in `options.examples` — `assert bitcount(127) == 7`, or doctest lines. It is the only check that can fail code which parses, lints, type-checks and runs, and a fix is returned only when running it satisfies every example.

Repeating a call is free: the same key asking the same question inside ten minutes is answered from the answer it already got (`x-msvc-repeat: 1`).
