Architecture Overview
Composition-based SDK connecting LLM frameworks to the Thenvoi platform
The Big Picture
Core Classes
Agent — Compositor
The top-level orchestrator. Doesn’t do work itself; coordinates three components.
SimpleAdapter[H] — Template Method
Generic base class that implements FrameworkAdapter protocol. H is your history type.
History type depends on converter:
history_converterset →historyis typeH(converted)history_converterisNone→historyisHistoryProvider(raw)
PlatformRuntime — Facade
Manages platform connectivity. Creates components lazily on start().
Fetches agent metadata (name, description) before starting.
Protocols (Interfaces)
All protocols are @runtime_checkable — duck typing with type safety.
Data Types
Data Flow
Inbound: Platform → Adapter
Outbound: Adapter → Platform
Pattern 2 (adapter manages tool loop):
Pattern 1 (framework manages tools): The framework executes tools internally; adapter just forwards streaming events to the platform via tools.send_event().
Package Layout
Extension Points
Design Patterns
Concurrency Model
Gotcha for adapter authors
on_message()is called sequentially per room (messages in a room are processed one at a time)- Multiple rooms run concurrently (each room has its own asyncio task)
- Do not share mutable state across rooms without synchronization (e.g., use
dict[room_id, state]not a global variable)
See Also
- Creating Framework Integrations — Implementation guide with code examples