Skip to content

Protocols

Core protocol interfaces following Interface Segregation Principle (ISP). Each protocol has at most 5 methods.

Memory Protocols

MessageStore

Bases: Protocol

Port: message storage.

FactStore

Bases: Protocol

Port: fact storage.

GoalStore

Bases: Protocol

Port: goal storage.

SummaryStore

Bases: Protocol

Port: rolling summary storage.

SessionStateStore

Bases: Protocol

Port: session state storage.

ToolEventStore

Bases: Protocol

Port: tool event storage.

Runtime Protocol

RuntimePort

Bases: Protocol

Port: runtime adapter for SDK (DIP instead of concrete RuntimeAdapter).

.. deprecated:: Use :class:AgentRuntime for new code. RuntimePort is kept for backward compatibility with existing SessionManager.

Session Protocols

SessionManager

Bases: SessionLifecycle, Protocol

Port: active session management.

Inherits SessionLifecycle (close/close_all). Total: 4 own + 2 from SessionLifecycle = backward compatible.

SessionRehydrator

Bases: Protocol

Port: session state rehydration.

Routing Protocols

RoleRouter

Bases: Protocol

Port: user-to-role routing.

ModelSelector

Bases: Protocol

Port: model selection (Sonnet/Opus).

Tools Protocols

ToolIdCodec

Bases: Protocol

Port: tool name normalization.

LocalToolResolver

Bases: Protocol

Port: local tool resolver (ISP, 2 methods).

Application implements this Protocol so the library can obtain a callable by tool_name. Library has no knowledge of concrete tools.

resolve

resolve(tool_name: str) -> Any | None

Get callable for a local tool by name.

Returns: Callable or None if tool not found.

list_tools

list_tools() -> list[str]

List available local tools.