Shared type definitions, protocols, and error hierarchy for AgentiCraft packages.
The type foundation behind AgentiCraft -- an enterprise-grade platform for building production-ready AI agents and multi-agent systems.
Pydantic v2 models · Protocol classes · Exception hierarchy · Configuration schemas · Zero business logic
Install
With uv (recommended):
uv add agenticraft-types
Or with pip:
pip install agenticraft-types
Quick Start
from agenticraft_types import (
CompletionRequest,
CompletionResponse,
ProviderName,
ProviderError,
RateLimitError,
RetryConfig,
)
# Build a typed request
request = CompletionRequest(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}],
max_tokens=100,
)
# Use enums for provider selection
provider = ProviderName.OPENAI
# Catch typed exceptions
try:
response = await some_provider.complete(request)
except RateLimitError as e:
print(f"Rate limited by {e.provider}, retry after {e.retry_after}s")
except ProviderError as e:
print(f"Provider {e.provider} failed: {e}")
Protocol-Based Typing
from agenticraft_types import Provider, Router, CircuitBreakerLike
# Structural typing -- implement the protocol, no inheritance needed
class MyProvider:
async def complete(self, messages, **kwargs) -> CompletionResponse: ...
async def stream(self, messages, **kwargs): ...
def route(provider: Provider) -> None:
# Type-safe without coupling to a base class
...
What's Inside
models-- Pydantic v2 request/response models (CompletionRequest,CompletionResponse,StreamChunk,Usage,Message)enums-- Shared enumerations (ProviderName,FailureType,RoutingStrategy,MessageRole,CircuitBreakerState)errors-- Exception hierarchy (AgentiCraftError,ProviderError,RateLimitError,AuthenticationError, etc.)protocols--typing.Protocolclasses for structural typing (Provider,Router,CircuitBreakerLike,KeyPoolLike)config-- Configuration schemas (RetryConfig,CircuitBreakerConfig,RateLimitConfig)
Design Rules
- Under 1,000 LOC total
- Zero business logic
- Only dependency:
pydantic>=2.0 - Apache 2.0 license
Development
# Install dev dependencies
uv sync --group dev
# Run tests
uv run pytest tests/ -v
# Run with coverage
uv run pytest tests/ --cov=agenticraft_types --cov-report=html
# Lint
uv run ruff check src/ tests/
# Format
uv run ruff format src/ tests/
# Type check
uv run pyright src/
# Pre-commit hooks
uv run pre-commit install
See CONTRIBUTING.md for full guidelines.
License
Apache 2.0
Part of the AgentiCraft platform.
Release files for agenticraft-types 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agenticraft_types-0.1.0.tar.gz | 51.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agenticraft_types-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 60.5 kB
Release files / agenticraft_types-0.1.0.tar.gz
| Download URL | agenticraft_types-0.1.0.tar.gz |
|---|---|
| Size | 51.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
062fadb2d72cfb30317f1b14591631d9d06010bb5317eaf7aa1434e5f9b0a873
|
|
BLAKE2b-256 checksum How to use checksums |
239e5be70d4554ad47bcac031f9b970fcf01bb7574e0d8efdd4df87b81bcb64f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 7, 2026.
Transparency logRelease files / agenticraft_types-0.1.0-py3-none-any.whl
| Download URL | agenticraft_types-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4eb5b89652d55d09b0f8170af6c05225298c509fd3d347ae133f3995dd39bca8
|
|
BLAKE2b-256 checksum How to use checksums |
7cc995da4983fd94ed0ab904f8d099359749bcc9314092d062fb3dfb5f1a9bee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 7, 2026.
Transparency log