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
Install a released wheel from this repo's GitHub Releases. See docs/foundry/releases/adopting.md for the full flow - pinning a release URL directly for evaluation, or hosting the wheel in your own index for production, plus verifying the SBOM/scan assets.
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) |
| Encryption | encrypt, decrypt, is_encrypted, load_encryption_key (AES-256-GCM) |
| Masking | mask_session_id, redact_session_ids for log sanitization |
Security
Session IDs in AgentRequest/AgentResponse must match pattern
^[A-Za-z0-9_-]+$ with 8-128 character length constraints
(DISA STIG V-222609). Invalid IDs raise ValidationError at model
construction. Input-size bounds enforce
resource limits (DISA STIG V-222612).