API reference¶
Generated from the apogee-ai-comunication source with mkdocstrings. Every symbol below is exported from apogee_ai_comunication, so it is part of the supported public surface.
Other¶
AgentCard
dataclass
¶
AgentCard(name: str, version: str = '0.1.0', description: str = '', url: str | None = None, protocols: tuple[str, ...] = (), capabilities: tuple[AgentSkill, ...] = (), auth_schemes: tuple[str, ...] = ('none',), extra: dict[str, object] = dict())
Public metadata used for cross-protocol agent discovery.
extra
class-attribute
instance-attribute
¶
AgentCardMapper
¶
to_dto
staticmethod
¶
to_dto(card: AgentCard) -> AgentCardDTO
Source code in apogee_ai_comunication/application/mappers/agent_card_mapper.py
@staticmethod
def to_dto(card: AgentCard) -> AgentCardDTO:
return AgentCardDTO(
name=card.name,
version=card.version,
description=card.description,
url=card.url,
protocols=list(card.protocols),
capabilities=[
AgentSkillDTO(
name=s.name,
description=s.description,
input_modes=list(s.input_modes),
output_modes=list(s.output_modes),
tags=list(s.tags),
)
for s in card.capabilities
],
auth_schemes=list(card.auth_schemes),
)
from_dto
staticmethod
¶
from_dto(dto: AgentCardDTO) -> AgentCard
Source code in apogee_ai_comunication/application/mappers/agent_card_mapper.py
@staticmethod
def from_dto(dto: AgentCardDTO) -> AgentCard:
return AgentCard(
name=dto.name,
version=dto.version,
description=dto.description,
url=dto.url,
protocols=tuple(dto.protocols),
capabilities=tuple(
AgentSkill(
name=s.name,
description=s.description,
input_modes=tuple(s.input_modes),
output_modes=tuple(s.output_modes),
tags=tuple(s.tags),
)
for s in dto.capabilities
),
auth_schemes=tuple(dto.auth_schemes),
)
AgentMessage
dataclass
¶
AgentMessage(role: MessageRole, parts: tuple[MessagePart, ...] = (), name: str | None = None, metadata: dict[str, object] = dict())
Neutral chat-style message that any protocol can map onto its wire-format.
metadata
class-attribute
instance-attribute
¶
AgentMessageMapper
¶
to_dto
staticmethod
¶
to_dto(msg: AgentMessage) -> AgentMessageDTO
Source code in apogee_ai_comunication/application/mappers/agent_message_mapper.py
from_dto
staticmethod
¶
from_dto(dto: AgentMessageDTO) -> AgentMessage
Source code in apogee_ai_comunication/application/mappers/agent_message_mapper.py
AgentSkill
dataclass
¶
AgentSkill(name: str, description: str = '', input_modes: tuple[str, ...] = ('text',), output_modes: tuple[str, ...] = ('text',), tags: tuple[str, ...] = ())
A discrete capability advertised by the agent.
AgentTask
dataclass
¶
AgentTask(task_id: str, state: TaskState = SUBMITTED, history: tuple[AgentMessage, ...] = (), artifacts: tuple[TaskArtifact, ...] = (), metadata: dict[str, object] = dict())
A long-running unit of work, observable via SSE.
metadata
class-attribute
instance-attribute
¶
AgentTaskMapper
¶
to_dto
staticmethod
¶
to_dto(task: AgentTask) -> AgentTaskDTO
Source code in apogee_ai_comunication/application/mappers/agent_task_mapper.py
@staticmethod
def to_dto(task: AgentTask) -> AgentTaskDTO:
return AgentTaskDTO(
task_id=task.task_id,
state=task.state.value,
history=[AgentMessageMapper.to_dto(m) for m in task.history],
artifacts=[
TaskArtifactDTO(
name=a.name, mime_type=a.mime_type, data=dict(a.data), url=a.url
)
for a in task.artifacts
],
metadata=dict(task.metadata),
)
from_dto
staticmethod
¶
from_dto(dto: AgentTaskDTO) -> AgentTask
Source code in apogee_ai_comunication/application/mappers/agent_task_mapper.py
@staticmethod
def from_dto(dto: AgentTaskDTO) -> AgentTask:
return AgentTask(
task_id=dto.task_id,
state=TaskState(dto.state),
history=tuple(AgentMessageMapper.from_dto(m) for m in dto.history),
artifacts=tuple(
TaskArtifact(
name=a.name, mime_type=a.mime_type, data=dict(a.data), url=a.url
)
for a in dto.artifacts
),
metadata=dict(dto.metadata),
)
AiCommFactory
¶
Convenience factory keyed by ProtocolKind.
engine="native" (default) picks zero-dep adapters; any other value attempts
to load the optional engine and may raise ProviderNotInstalledError.
build_server
staticmethod
¶
build_server(kind: ProtocolKind, config: ServerConfig, *, engine: str = 'native', agent_card: AgentCard | None = None, **kwargs: Any) -> Any
Source code in apogee_ai_comunication/infrastructure/factory/ai_comm_factory.py
@staticmethod
def build_server(
kind: ProtocolKind,
config: ServerConfig,
*,
engine: str = "native",
agent_card: AgentCard | None = None,
**kwargs: Any,
) -> Any:
if kind is ProtocolKind.MCP:
if engine == "native":
from apogee_ai_comunication.infrastructure.mcp.native_mcp_server import (
NativeMcpServer,
)
return NativeMcpServer(config)
if engine == "fastmcp":
from apogee_ai_comunication.infrastructure.mcp.fastmcp_server import (
FastMcpServer,
)
return FastMcpServer(config)
if kind is ProtocolKind.A2A:
card = agent_card or AgentCard(name="apogee-a2a-agent")
if engine == "native":
from apogee_ai_comunication.infrastructure.a2a.native_a2a_server import (
NativeA2aServer,
)
return NativeA2aServer(config, card, kwargs.get("worker"))
if engine == "a2a-sdk":
from apogee_ai_comunication.infrastructure.a2a.a2a_sdk_server import (
A2aSdkServer,
)
return A2aSdkServer(config, card)
if kind is ProtocolKind.AG_UI:
if engine == "native":
from apogee_ai_comunication.infrastructure.ag_ui.native_ag_ui_server import (
NativeAgUiServer,
)
return NativeAgUiServer(config, kwargs.get("handler"))
if engine == "ag-ui-protocol":
from apogee_ai_comunication.infrastructure.ag_ui.ag_ui_protocol_server import (
AgUiProtocolServer,
)
return AgUiProtocolServer(config)
if kind is ProtocolKind.ACP:
if engine == "native":
from apogee_ai_comunication.infrastructure.acp.native_acp_server import (
NativeAcpServer,
)
return NativeAcpServer(config, kwargs.get("handler"))
if engine == "acp-sdk":
from apogee_ai_comunication.infrastructure.acp.acp_sdk_server import (
AcpSdkServer,
)
return AcpSdkServer(config)
if kind is ProtocolKind.MCP_UI:
from apogee_ai_comunication.infrastructure.mcp_ui.native_ui_provider import (
NativeUiProvider,
)
return NativeUiProvider()
if kind is ProtocolKind.A2UI:
from apogee_ai_comunication.infrastructure.a2ui.native_renderer import (
NativeA2uiRenderer,
)
return NativeA2uiRenderer()
raise ProtocolError(f"unsupported (kind={kind!s}, engine={engine})")
build_client
staticmethod
¶
build_client(kind: ProtocolKind, config: ClientConfig, *, engine: str = 'native', server: Any = None) -> Any
Source code in apogee_ai_comunication/infrastructure/factory/ai_comm_factory.py
@staticmethod
def build_client(
kind: ProtocolKind,
config: ClientConfig,
*,
engine: str = "native",
server: Any = None,
) -> Any:
if kind is ProtocolKind.MCP:
if engine == "native":
from apogee_ai_comunication.infrastructure.mcp.native_mcp_client import (
NativeMcpClient,
)
return NativeMcpClient(config, dispatcher=getattr(server, "dispatch", None))
if engine == "fastmcp":
from apogee_ai_comunication.infrastructure.mcp.fastmcp_client import (
FastMcpClient,
)
return FastMcpClient(config)
if kind is ProtocolKind.A2A:
from apogee_ai_comunication.infrastructure.a2a.native_a2a_client import (
NativeA2aClient,
)
if server is None:
raise ProtocolError("A2A native client requires a server reference")
return NativeA2aClient(config, server)
if kind is ProtocolKind.ACP:
from apogee_ai_comunication.infrastructure.acp.native_acp_client import (
NativeAcpClient,
)
if server is None:
raise ProtocolError("ACP native client requires a server reference")
return NativeAcpClient(config, server)
raise ProtocolError(f"unsupported client (kind={kind!s}, engine={engine})")
AuthConfig
dataclass
¶
AuthConfig(scheme: AuthScheme = NONE, token: str | None = None, issuer: str | None = None, audience: str | None = None)
AuthScheme
¶
ClientConfig
dataclass
¶
ClientConfig(base_url: str, auth_scheme: AuthScheme = NONE, auth_token: str | None = None, timeout_seconds: float = 30.0, extras: dict[str, object] = dict())
extras
class-attribute
instance-attribute
¶
ComponentCatalog
dataclass
¶
DEFAULT_CATALOG
module-attribute
¶
DEFAULT_CATALOG = ComponentCatalog(components={(type): s for s in _DEFAULT_SPECS})
IframeDescriptor
dataclass
¶
IframeDescriptor(src: str, sandbox: tuple[str, ...] = ('allow-scripts', 'allow-forms', 'allow-same-origin'), width: str = '100%', height: str = '600', extra_attrs: dict[str, str] = dict())
InMemoryObservabilityEmitter
¶
Bases: IObservabilityEmitter
Source code in apogee_ai_comunication/infrastructure/observability/in_memory_observability_emitter.py
InMemoryToolRegistry
¶
Bases: IToolRegistry
Thread-safe-by-coroutine, in-memory registry of tools.
Source code in apogee_ai_comunication/infrastructure/tool_registry/in_memory_tool_registry.py
register
¶
register(definition: ToolDefinition, handler: ToolHandler) -> None
list_tools
¶
list_tools() -> list[ToolDefinition]
get_handler
¶
invoke
async
¶
invoke(invocation: ToolInvocation) -> ToolResult
Source code in apogee_ai_comunication/infrastructure/tool_registry/in_memory_tool_registry.py
async def invoke(self, invocation: ToolInvocation) -> ToolResult:
handler = self._handlers.get(invocation.name)
if handler is None:
raise ToolInvocationError(
f"Unknown tool: {invocation.name}", tool_name=invocation.name
)
try:
return await handler(invocation)
except ToolInvocationError:
raise
except Exception as exc: # noqa: BLE001
return ToolResult(
call_id=invocation.call_id,
content=None,
is_error=True,
error_message=str(exc),
)
LifecycleEvents
¶
tool_result
staticmethod
¶
tool_result(name: str, content: object, *, is_error: bool = False) -> UiEvent
MessagePart
dataclass
¶
MessagePart(kind: str, text: str | None = None, data: dict[str, object] | None = None, mime_type: str | None = None)
A piece of message content. kind ∈ text|tool_call|tool_result|file|ui.
MessageRole
¶
NativeA2aClient
¶
NativeA2aClient(config: ClientConfig, server: NativeA2aServer)
Bases: IA2aClient
Source code in apogee_ai_comunication/infrastructure/a2a/native_a2a_client.py
NativeA2aServer
¶
NativeA2aServer(config: ServerConfig, agent_card: AgentCard, worker: TaskWorker | None = None)
Bases: IA2aServer
In-process A2A server suitable for native deployments and tests.
Source code in apogee_ai_comunication/infrastructure/a2a/native_a2a_server.py
def __init__(
self,
config: ServerConfig,
agent_card: AgentCard,
worker: TaskWorker | None = None,
) -> None:
self._config = config
self._card = agent_card
self._worker: TaskWorker = worker or self._default_worker
self._tasks: dict[str, AgentTask] = {}
self._streams: dict[str, asyncio.Queue[AgentTask]] = {}
self._stop_event = asyncio.Event()
handle_task
async
¶
handle_task(message: AgentMessage) -> AgentTask
Source code in apogee_ai_comunication/infrastructure/a2a/native_a2a_server.py
async def handle_task(self, message: AgentMessage) -> AgentTask:
task_id = uuid.uuid4().hex
task = AgentTask(task_id=task_id, state=TaskState.SUBMITTED, history=(message,))
self._tasks[task_id] = task
queue: asyncio.Queue[AgentTask] = asyncio.Queue()
self._streams[task_id] = queue
await queue.put(task)
asyncio.create_task(self._run_task(task, message, queue))
return task
stream_task
async
¶
stream_task(task_id: str) -> AsyncIterator[AgentTask]
Source code in apogee_ai_comunication/infrastructure/a2a/native_a2a_server.py
run
async
¶
stop
async
¶
NativeA2uiRenderer
¶
NativeA2uiRenderer(catalog: ComponentCatalog | None = None)
Bases: IA2uiRenderer
Source code in apogee_ai_comunication/infrastructure/a2ui/native_renderer.py
validate
¶
validate(root: UiComponent) -> list[str]
render
¶
render(root: UiComponent) -> dict[str, object]
NativeAcpClient
¶
NativeAcpClient(config: ClientConfig, server: NativeAcpServer)
Bases: IAcpClient
Source code in apogee_ai_comunication/infrastructure/acp/native_acp_client.py
send
async
¶
send(message: AgentMessage) -> AgentMessage
close
async
¶
NativeAcpServer
¶
NativeAcpServer(config: ServerConfig, handler: AcpHandler | None = None)
Bases: IAcpServer
Minimal in-process ACP server.
Source code in apogee_ai_comunication/infrastructure/acp/native_acp_server.py
NativeAgUiServer
¶
NativeAgUiServer(config: ServerConfig, handler: AgUiHandler | None = None)
Bases: IAgUiServer
Pumps events through a NativeEventEmitter for an in-process AG-UI session.
Source code in apogee_ai_comunication/infrastructure/ag_ui/native_ag_ui_server.py
stream_events
async
¶
stream_events(message: AgentMessage) -> AsyncIterator[UiEvent]
Source code in apogee_ai_comunication/infrastructure/ag_ui/native_ag_ui_server.py
async def stream_events(self, message: AgentMessage) -> AsyncIterator[UiEvent]:
emitter = NativeEventEmitter()
run_id = "run-1"
await emitter.emit(start_event(run_id))
async def runner() -> None:
try:
await self._handler(message, emitter)
finally:
await emitter.emit(finish_event(run_id))
await emitter.close()
import asyncio
asyncio.create_task(runner())
async for event in emitter.stream():
yield event
run
async
¶
stop
async
¶
NativeEventEmitter
¶
Bases: IAgUiEventEmitter
Buffered event queue → SSE / DTO stream.
Source code in apogee_ai_comunication/infrastructure/ag_ui/native_event_emitter.py
NativeMcpClient
¶
NativeMcpClient(config: ClientConfig, *, pipe: InMemoryPipe | None = None, dispatcher=None, http_client: AsyncClient | None = None)
Bases: IMcpClient
Source code in apogee_ai_comunication/infrastructure/mcp/native_mcp_client.py
def __init__(
self,
config: ClientConfig,
*,
pipe: InMemoryPipe | None = None,
dispatcher=None,
http_client: httpx.AsyncClient | None = None,
) -> None:
self._config = config
self._pipe = pipe
self._dispatcher = dispatcher # callable (str) -> awaitable[str|None]
self._http = http_client
self._owns_http = http_client is None
self._counter = 0
list_tools
async
¶
list_tools() -> list[ToolDefinition]
Source code in apogee_ai_comunication/infrastructure/mcp/native_mcp_client.py
call_tool
async
¶
call_tool(invocation: ToolInvocation) -> ToolResult
Source code in apogee_ai_comunication/infrastructure/mcp/native_mcp_client.py
async def call_tool(self, invocation: ToolInvocation) -> ToolResult:
result = await self._request(
"tools/call",
{
"name": invocation.name,
"arguments": dict(invocation.arguments),
"call_id": invocation.call_id,
},
)
is_error = bool(result.get("isError"))
content_blocks = result.get("content") or []
first = content_blocks[0] if content_blocks else {}
text = first.get("text") if isinstance(first, dict) else None
return ToolResult(
call_id=invocation.call_id,
content=text,
is_error=is_error,
error_message=text if is_error else None,
)
get_resource
async
¶
get_resource(uri: str) -> ResourceDescriptor
Source code in apogee_ai_comunication/infrastructure/mcp/native_mcp_client.py
async def get_resource(self, uri: str) -> ResourceDescriptor:
result = await self._request("resources/read", {"uri": uri})
contents = result.get("contents") or []
if not contents:
raise ProtocolError(f"empty resource: {uri}", code=-32602)
first = contents[0]
return ResourceDescriptor(
uri=first.get("uri", uri),
name=first.get("uri", uri),
mime_type=first.get("mimeType", "text/plain"),
contents=first.get("text"),
)
close
async
¶
NativeMcpServer
¶
NativeMcpServer(config: ServerConfig)
Bases: IMcpServer
Pure-Python MCP server with the methods required by the public spec.
Implements
initialize, tools/list, tools/call, resources/list, resources/read, prompts/list, prompts/get, ping.
Source code in apogee_ai_comunication/infrastructure/mcp/native_mcp_server.py
register_tool
¶
register_tool(definition: ToolDefinition, handler: ToolHandler) -> None
register_resource
¶
register_resource(resource: ResourceDescriptor) -> None
register_prompt
¶
register_prompt(prompt: PromptTemplate) -> None
run
async
¶
stop
async
¶
tool
¶
tool(definition: ToolDefinition) -> Callable[[Callable[..., Awaitable[Any]]], Callable[..., Awaitable[Any]]]
Decorator: registers a coroutine as the handler for definition.
Source code in apogee_ai_comunication/infrastructure/mcp/native_mcp_server.py
def tool(self, definition: ToolDefinition) -> Callable[
[Callable[..., Awaitable[Any]]], Callable[..., Awaitable[Any]]
]:
"""Decorator: registers a coroutine as the handler for `definition`."""
def decorator(
fn: Callable[..., Awaitable[Any]],
) -> Callable[..., Awaitable[Any]]:
async def handler(invocation: ToolInvocation):
from apogee_ai_comunication.domain.entities.tool_result import ToolResult
content = await fn(**dict(invocation.arguments))
return ToolResult(call_id=invocation.call_id, content=content)
self._registry.register(definition, handler)
return fn
return decorator
dispatch
async
¶
Source code in apogee_ai_comunication/infrastructure/mcp/native_mcp_server.py
async def dispatch(self, raw: str | bytes) -> str | None:
envelope = JsonRpcCodec.decode(raw)
method = envelope.get("method")
params = envelope.get("params") or {}
req_id = envelope.get("id")
try:
result = await self._handle(str(method), params)
except ProtocolError as exc:
resp = JsonRpcResponse(
id=req_id, error=JsonRpcError(exc.code or -32601, exc.message)
)
return JsonRpcCodec.encode_response(resp)
except Exception as exc: # noqa: BLE001
resp = JsonRpcResponse(id=req_id, error=JsonRpcError(-32603, str(exc)))
return JsonRpcCodec.encode_response(resp)
if req_id is None:
return None # notification, no response
return JsonRpcCodec.encode_response(JsonRpcResponse(id=req_id, result=result))
make_request
staticmethod
¶
make_request(method: str, params: dict[str, Any] | None = None, id_: str | int | None = None) -> str
Source code in apogee_ai_comunication/infrastructure/mcp/native_mcp_server.py
NativeUiProvider
¶
Bases: IMcpUiProvider
Source code in apogee_ai_comunication/infrastructure/mcp_ui/native_ui_provider.py
register_ui
¶
register_ui(resource: ResourceDescriptor) -> None
Source code in apogee_ai_comunication/infrastructure/mcp_ui/native_ui_provider.py
serve
async
¶
serve(uri: str) -> ResourceDescriptor
NoOpObservabilityEmitter
¶
Bases: IObservabilityEmitter
emit
¶
PromptTemplate
dataclass
¶
PromptTemplate(name: str, description: str = '', arguments: dict[str, object] = dict(), template: str = '')
arguments
class-attribute
instance-attribute
¶
ReactPayloadEmitter
¶
ReactPayloadEmitter(renderer: NativeA2uiRenderer | None = None)
Source code in apogee_ai_comunication/infrastructure/a2ui/react_payload_emitter.py
emit
¶
emit(root: UiComponent) -> str
ResourceDescriptor
dataclass
¶
ResourceDescriptor(uri: str, name: str, mime_type: str = 'text/plain', description: str = '', contents: str | bytes | None = None)
ServerConfig
dataclass
¶
ServerConfig(host: str = '127.0.0.1', port: int = 8000, transport: TransportKind = HTTP_SSE, auth_scheme: AuthScheme = NONE, auth_token: str | None = None, public_url: str | None = None, extras: dict[str, object] = dict())
extras
class-attribute
instance-attribute
¶
StreamingConfig
dataclass
¶
TaskArtifact
dataclass
¶
TaskArtifact(name: str, mime_type: str = 'application/json', data: dict[str, object] = dict(), url: str | None = None)
A produced output (file, structured data, link).
data
class-attribute
instance-attribute
¶
TaskState
¶
Bases: str, Enum
ToolDefinition
dataclass
¶
ToolDefinition(name: str, description: str = '', input_schema: dict[str, object] = dict(), output_schema: dict[str, object] | None = None, annotations: dict[str, object] = dict())
ToolInvocation
dataclass
¶
ToolMapper
¶
def_to_dto
staticmethod
¶
def_to_dto(d: ToolDefinition) -> ToolDefinitionDTO
Source code in apogee_ai_comunication/application/mappers/tool_mapper.py
def_from_dto
staticmethod
¶
def_from_dto(dto: ToolDefinitionDTO) -> ToolDefinition
Source code in apogee_ai_comunication/application/mappers/tool_mapper.py
inv_to_dto
staticmethod
¶
inv_to_dto(i: ToolInvocation) -> ToolInvocationDTO
inv_from_dto
staticmethod
¶
inv_from_dto(dto: ToolInvocationDTO) -> ToolInvocation
res_to_dto
staticmethod
¶
res_to_dto(r: ToolResult) -> ToolResultDTO
res_from_dto
staticmethod
¶
res_from_dto(dto: ToolResultDTO) -> ToolResult
ToolResult
dataclass
¶
TransportConfig
dataclass
¶
TransportConfig(kind: TransportKind = HTTP_SSE, keepalive_seconds: float = 15.0, max_message_bytes: int = 4 * 1024 * 1024)
max_message_bytes
class-attribute
instance-attribute
¶
UiComponent
dataclass
¶
UiComponent(type: str, props: dict[str, object] = dict(), children: tuple['UiComponent', ...] = (), binding: str | None = None)
Node in a declarative UI tree (e.g. A2UI Card, Button, TextField).
props
class-attribute
instance-attribute
¶
UiEvent
dataclass
¶
UiEvent(kind: UiEventKind, payload: dict[str, object] = dict(), sequence: int | None = None)
A single event emitted on the AG-UI stream.
payload
class-attribute
instance-attribute
¶
UiEventMapper
¶
to_dto
staticmethod
¶
to_dto(e: UiEvent) -> UiEventDTO
from_dto
staticmethod
¶
from_dto(dto: UiEventDTO) -> UiEvent
Other · DTOs¶
AgentCardDTO
¶
Bases: BaseModel
protocols
class-attribute
instance-attribute
¶
capabilities
class-attribute
instance-attribute
¶
capabilities: list[AgentSkillDTO] = Field(default_factory=list)
auth_schemes
class-attribute
instance-attribute
¶
AgentMessageDTO
¶
Bases: BaseModel
parts
class-attribute
instance-attribute
¶
parts: list[MessagePartDTO] = Field(default_factory=list)
metadata
class-attribute
instance-attribute
¶
AgentSkillDTO
¶
AgentTaskDTO
¶
Bases: BaseModel
history
class-attribute
instance-attribute
¶
history: list[AgentMessageDTO] = Field(default_factory=list)
artifacts
class-attribute
instance-attribute
¶
artifacts: list[TaskArtifactDTO] = Field(default_factory=list)
metadata
class-attribute
instance-attribute
¶
MessagePartDTO
¶
Bases: BaseModel
ToolDefinitionDTO
¶
ToolResultDTO
¶
Bases: BaseModel
Other · Enums¶
ProtocolKind
¶
Bases: str, Enum
Identifies which protocol a server/client speaks.
TransportKind
¶
Bases: str, Enum
UiEventKind
¶
Bases: str, Enum
Other · Exceptions¶
AiCommException
¶
Bases: Exception
Root of every exception raised by apogee_ai_comunication.
Source code in apogee_ai_comunication/domain/exceptions/ai_comm_exception.py
AuthError
¶
Bases: AiCommException
Raised when credentials are missing, expired or insufficient.
Source code in apogee_ai_comunication/domain/exceptions/ai_comm_exception.py
ProtocolError
¶
Bases: AiCommException
Raised when a payload violates the protocol contract.
Source code in apogee_ai_comunication/domain/exceptions/protocol_error.py
ProviderNotInstalledError
¶
Bases: AiCommException
The optional dependency that backs an adapter is not installed.
Source code in apogee_ai_comunication/domain/exceptions/provider_not_installed_error.py
ToolInvocationError
¶
Bases: AiCommException
The tool returned an error or could not be invoked.
Source code in apogee_ai_comunication/domain/exceptions/tool_invocation_error.py
TransportError
¶
Bases: AiCommException
Network, encoding or serialization failure on the transport layer.
Source code in apogee_ai_comunication/domain/exceptions/ai_comm_exception.py
Other · Protocols (ports)¶
IA2aClient
¶
IA2aServer
¶
IA2uiRenderer
¶
Bases: Protocol
render
¶
render(root: UiComponent) -> dict[str, object]
validate
¶
validate(root: UiComponent) -> list[str]
IAcpClient
¶
Bases: Protocol
send
async
¶
send(message: AgentMessage) -> AgentMessage
close
async
¶
IAcpServer
¶
Bases: Protocol
IAgUiServer
¶
Bases: Protocol
stream_events
async
¶
stream_events(message: AgentMessage) -> AsyncIterator[UiEvent]
run
async
¶
stop
async
¶
IMcpClient
¶
Bases: Protocol
list_tools
async
¶
list_tools() -> list[ToolDefinition]
call_tool
async
¶
call_tool(invocation: ToolInvocation) -> ToolResult
get_resource
async
¶
get_resource(uri: str) -> ResourceDescriptor
close
async
¶
IMcpServer
¶
Bases: Protocol
register_tool
¶
register_tool(definition: ToolDefinition, handler: ToolHandler) -> None
register_resource
¶
register_resource(resource: ResourceDescriptor) -> None
register_prompt
¶
register_prompt(prompt: PromptTemplate) -> None
run
async
¶
stop
async
¶
IMcpUiProvider
¶
Bases: Protocol
register_ui
¶
register_ui(resource: ResourceDescriptor) -> None
serve
async
¶
serve(uri: str) -> ResourceDescriptor
IMessageRouter
¶
Bases: Protocol
route
async
¶
route(target: ProtocolKind, message: AgentMessage) -> AgentMessage
IToolRegistry
¶
Bases: Protocol
register
¶
register(definition: ToolDefinition, handler: ToolHandler) -> None
list_tools
¶
list_tools() -> list[ToolDefinition]
get_handler
¶
invoke
async
¶
invoke(invocation: ToolInvocation) -> ToolResult
Other · Use cases¶
InvokeMcpToolUseCase
dataclass
¶
InvokeMcpToolUseCase(client: IMcpClient)
execute
async
¶
execute(invocation: ToolInvocation) -> ToolResult
PublishAgentCardUseCase
dataclass
¶
PublishAgentCardUseCase(server: IA2aServer)
execute
¶
execute() -> AgentCardDTO
RenderA2uiTreeUseCase
dataclass
¶
RenderA2uiTreeUseCase(renderer: IA2uiRenderer)
execute
¶
execute(root: UiComponent) -> dict[str, object]
Source code in apogee_ai_comunication/application/use_cases/render_a2ui_tree_use_case.py
RouteMessageUseCase
dataclass
¶
RouteMessageUseCase(router: IMessageRouter)
execute
async
¶
execute(target: ProtocolKind, message: AgentMessage) -> AgentMessage
SendA2aTaskUseCase
dataclass
¶
SendA2aTaskUseCase(client: IA2aClient)
execute
async
¶
execute(message: AgentMessage) -> AsyncIterator[AgentTask]
ServeMcpUiResourceUseCase
dataclass
¶
ServeMcpUiResourceUseCase(provider: IMcpUiProvider)
execute
async
¶
execute(uri: str) -> ResourceDescriptor
StreamAgUiEventsUseCase
dataclass
¶
StreamAgUiEventsUseCase(server: IAgUiServer)
execute
async
¶
execute(message: AgentMessage) -> AsyncIterator[UiEvent]