Skip to content

RFC-014: Contract Governor Shared Infrastructure — 3. Package Distribution

AIGP SpecificationRFC-014: Contract Governor Shared Infrastructure › 3. Package Distribution

← 2. Architecture · Section index · 4. Per-Amigo Contracts →

3. Package Distribution

Contract Governor is distributed as a pip package installed directly into each amigo’s Docker image. It is NOT a sidecar, NOT a shared service, NOT a runtime dependency on another container.

3.1 Installation

Each amigo’s Dockerfile installs the package:

# From private PyPI / CodeArtifact
RUN pip install contract-governor==1.3.144
# Or from local wheel during build
COPY dist/contract_governor-1.3.144-py3-none-any.whl /tmp/
RUN pip install /tmp/contract_governor-1.3.144-py3-none-any.whl

3.2 Package Contents

contract_governor/
__init__.py # ContractGovernor, StipulationConfig, ValidationResult
core/
contract_governor.py # Central orchestrator
models.py # Pydantic models
stipulation_processor.py
stipulation_linker.py
registry.py
validation/
pipeline.py # ValidationPipeline
validators.py # Individual validators
openapi_validator.py # OpenAPI spec validation
transformation/
pipeline.py # TransformationPipeline
transformers.py
loaders/
contract_loader.py # YAML/JSON contract loading
s3_loader.py # S3-backed contract loading
config/
manager.py # Configuration management
integrations/
fastapi_server.py # FastAPI integration

3.3 Why Not a Sidecar

Approach Latency Failure Mode Complexity
pip package (chosen) In-process, ~0ms App fails = validation fails Low
Sidecar container Network hop, ~5-50ms Sidecar crash = app blind High
Shared service Network hop, ~10-100ms Service down = all amigos blind Very high

The validation engine runs in-process. No network calls. No container orchestration. No service discovery.


← 2. Architecture · Section index · 4. Per-Amigo Contracts →