Shared type definitions, protocols, and error hierarchy for AgentiCraft packages
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agenticraft_types-0.1.0.tar.gz.
File metadata
- Download URL: agenticraft_types-0.1.0.tar.gz
- Upload date:
- Size: 51.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
062fadb2d72cfb30317f1b14591631d9d06010bb5317eaf7aa1434e5f9b0a873
|
|
| MD5 |
3595fb59d3189451508436cb0c14499f
|
|
| BLAKE2b-256 |
239e5be70d4554ad47bcac031f9b970fcf01bb7574e0d8efdd4df87b81bcb64f
|
Provenance
The following attestation bundles were made for agenticraft_types-0.1.0.tar.gz:
Publisher:
release.yml on agenticraft/agenticraft-types
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agenticraft_types-0.1.0.tar.gz -
Subject digest:
062fadb2d72cfb30317f1b14591631d9d06010bb5317eaf7aa1434e5f9b0a873 - Sigstore transparency entry: 1056998558
- Sigstore integration time:
-
Permalink:
agenticraft/agenticraft-types@de3e75e4e6a6d3b67087375c79fa9e62fc52bca3 -
Branch / Tag:
refs/tags/types-v0.1.0 - Owner: https://github.com/agenticraft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@de3e75e4e6a6d3b67087375c79fa9e62fc52bca3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agenticraft_types-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agenticraft_types-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4eb5b89652d55d09b0f8170af6c05225298c509fd3d347ae133f3995dd39bca8
|
|
| MD5 |
7010c32f8be9b2884eba0503c867d1a0
|
|
| BLAKE2b-256 |
7cc995da4983fd94ed0ab904f8d099359749bcc9314092d062fb3dfb5f1a9bee
|
Provenance
The following attestation bundles were made for agenticraft_types-0.1.0-py3-none-any.whl:
Publisher:
release.yml on agenticraft/agenticraft-types
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agenticraft_types-0.1.0-py3-none-any.whl -
Subject digest:
4eb5b89652d55d09b0f8170af6c05225298c509fd3d347ae133f3995dd39bca8 - Sigstore transparency entry: 1056998563
- Sigstore integration time:
-
Permalink:
agenticraft/agenticraft-types@de3e75e4e6a6d3b67087375c79fa9e62fc52bca3 -
Branch / Tag:
refs/tags/types-v0.1.0 - Owner: https://github.com/agenticraft
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@de3e75e4e6a6d3b67087375c79fa9e62fc52bca3 -
Trigger Event:
push
-
Statement type: