foundry-agent-core
Framework-agnostic agent infrastructure: dependency-injection container, protocol surface, exception hierarchy, request/response types, and lifecycle primitives. Zero coupling to any specific agent framework.
Install
uv add foundry-agent-core
# or
pip install foundry-agent-core
Quickstart
from foundry_agent_core import (
AgentRequest,
AgentResponse,
create_dependency_container,
)
container = create_dependency_container()
container.register_factory(MyService, my_service_factory, singleton=True)
service = container.resolve(MyService)
request = AgentRequest(session_id="user-session-01", query="Hello")
What's in the box
| Surface | Highlights |
|---|---|
| DI container | create_dependency_container(), scoped resolution, cycle detection, startup validation |
| Protocols | AgentBackend, QueryProcessor, ResponseProcessor, ErrorTranslator, DependencyContainer |
| Types | AgentRequest, AgentResponse (Pydantic v2, frozen) |
| Exceptions | DomainError and a typed hierarchy (ConfigurationError, AgentCreationError, ExternalServiceError, ToolExecutionError, QueryTimeoutError, …) |
Security
Session IDs in AgentRequest/AgentResponse must match
^[A-Za-z0-9_-]{8,128}$ (DISA STIG V-222609). Invalid IDs raise
ValidationError at model construction. See the
STIG checklist
for the full control list.