Getting Started
Install AgentiCraft packages and build your first LLM-powered agent in minutes.
1 min read
Installation
AgentiCraft is distributed as three focused Python packages. Install what you need:
# Core types and protocols (dependency of other packages)
uv add agenticraft-types
# LLM provider abstraction with routing and resilience
uv add agenticraft-llm
# Formal foundations (CSP algebra, topology analysis)
uv add agenticraft-foundationOr install everything at once:
uv add agenticraft-foundation agenticraft-llm agenticraft-typesProvider Extras
agenticraft-llm uses optional dependencies for each provider. Install only what you need:
# OpenAI (GPT-5.4, GPT-5-mini, etc.)
uv add "agenticraft-llm[openai]"
# Anthropic (Claude)
uv add "agenticraft-llm[anthropic]"
# Google (Gemini)
uv add "agenticraft-llm[google]"
# Multiple providers
uv add "agenticraft-llm[openai,anthropic,google]"
# All providers
uv add "agenticraft-llm[all]"Requirements
- Python 3.10 or later
- uv package manager (recommended)
- At least one LLM provider API key
Your First LLM Call
import asyncio
from agenticraft_llm import LLMProviderConfig, create_provider
async def main():
# Configure a provider
config = LLMProviderConfig(
provider="openai",
api_key="sk-...",
model="gpt-5-mini",
)
# Create and use it
provider = create_provider(config)
response = await provider.complete(
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.content)
asyncio.run(main())Multi-Provider Routing
Route requests across providers based on cost, latency, or availability:
from agenticraft_llm import CostAwareRouter, LLMProviderConfig
router = CostAwareRouter(
providers=[
LLMProviderConfig(provider="openai", model="gpt-5-mini"),
LLMProviderConfig(provider="anthropic", model="claude-haiku-4-5-20251001"),
]
)
# Router picks the optimal provider
response = await router.complete(
messages=[{"role": "user", "content": "Summarize this document..."}]
)Key Rotation
Manage multiple API keys per provider with automatic rotation:
from agenticraft_llm import KeyPoolManager
pool = KeyPoolManager(
keys=["sk-key1", "sk-key2", "sk-key3"],
strategy="least_used", # round_robin, random, least_used, weighted, failover
)
# Keys rotate automatically
key = pool.get_key()Next Steps
- Architecture Overview — how the packages fit together
- Foundation API Reference — formal verification and topology
- LLM API Reference — providers, routing, resilience
- Types API Reference — shared models and protocols