Files
Emil Shanaty 0cfb4277b5 aicc-py 0.1.0: initial SDK
- protocol.py: pydantic models for all AICC message types (envelope,
  session_init, tool_call, tool_result, event, error, heartbeat)
- bridge.py: Bridge with @bridge.tool registration, capability checks,
  session management, serve_forever
- client.py: AICCClient with single background reader (safe on
  concurrent transports like WebSocket), call_tool, events, manifest
- tool.py: @tool decorator with schema generation from type hints
- schema.py: JSON Schema generation (str/int/float/bool, list, dict,
  Optional, pydantic models)
- transport: Transport protocol, InProcessTransport, WebSocket client+server
- tests: 12 passing (integration, schema, websocket roundtrip)
- examples: bridge_minimal.py + agent_minimal.py (verified end-to-end)
2026-08-08 03:10:35 +03:00

36 lines
832 B
Python

"""AICC exception hierarchy."""
from __future__ import annotations
from aicc.protocol import ErrorCode
class AICCError(Exception):
"""Base for all AICC SDK errors."""
class ProtocolError(AICCError):
"""Protocol-level error (version mismatch, malformed message)."""
class ConnectionError_(AICCError):
"""Transport / session connection failure."""
class SessionExpiredError(AICCError):
"""Session id is unknown or closed."""
class ToolError(AICCError):
"""Tool execution failure surfaced by the bridge."""
def __init__(self, code: ErrorCode, message: str, retryable: bool):
super().__init__(message)
self.code = code
self.message = message
self.retryable = retryable
class CapabilityError(AICCError):
"""Tool requires a capability the agent does not hold."""