Core Components Overview
The Core Components form the foundation of the TKM AI Agency Platform, providing essential infrastructure for agent communication, event handling, and data management. The system consists of four main components:
Key Components
1. Mediator (Communication Handler)
The central nervous system of the platform that:
- Manages direct communication between agents
- Handles agent registration and type categorization (CRM/Backoffice)
- Controls conversation states and blocking operations
- Maintains routing history and permissions
2. Events (Message Bus)
An asynchronous event system that:
- Implements a publish-subscribe pattern for agent notifications
- Manages event logging and history tracking
- Provides both fire-and-forget and request-response patterns
- Handles timeout and error recovery in event processing
3. Router (Agent Dispatcher)
A specialized routing system that:
- Provides agent-specific request handlers
- Manages request preparation and transformation
- Handles context enrichment and validation
- Coordinates response processing and state updates
4. Types (Data Structures)
The foundational type system that:
- Defines core data structures using Pydantic models
- Manages state enumerations and message types
- Provides standardized response formats
- Ensures type safety and validation across the platform
System Architecture
The components work together in a layered architecture:
- Types provide the foundational data structures
- Events enable asynchronous communication
- Router manages specialized request handling
- Mediator orchestrates the overall flow
This architecture ensures:
- Loose coupling between agents
- Standardized communication patterns
- Robust error handling
- Scalable and maintainable codebase