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

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

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)
Encryptionencrypt, decrypt, is_encrypted, load_encryption_key (AES-256-GCM)
Maskingmask_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).

Reference