Skip to main content

foundry-agent-core

Status: Available Version Python

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

SurfaceHighlights
DI containercreate_dependency_container(), scoped resolution, cycle detection, startup validation
ProtocolsAgentBackend, QueryProcessor, ResponseProcessor, ErrorTranslator, DependencyContainer
TypesAgentRequest, AgentResponse (Pydantic v2, frozen)
ExceptionsDomainError 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.

Reference