You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/design/01_Overview.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,23 +19,23 @@ The agent-swarm-kit follows a layered architecture centered around a dependency
19
19
20
20
### High-Level System Flow
21
21
22
-

22
+

23
23
24
24
## Core Components
25
25
26
26
### Agent Execution Engine
27
27
28
28
The `ClientAgent` class serves as the core execution engine for individual agents, handling message processing, tool calls, and AI model interactions:
29
29
30
-

30
+

31
31
32
32
The `ClientAgent` implements sophisticated execution patterns including tool call validation, model recovery strategies, and event-driven communication through subjects for handling agent state changes, tool outputs, and error conditions.
33
33
34
34
### Session Management
35
35
36
36
The session layer manages client connections and message flow through the swarm system:
37
37
38
-

38
+

39
39
40
40
The `ClientSession` enforces policy validation for both input and output messages, coordinates with the swarm for agent execution, and provides event-driven messaging capabilities for real-time client communication.
41
41
@@ -55,7 +55,7 @@ The swarm maintains a navigation stack that allows agents to call each other and
55
55
56
56
The system processes messages through a well-defined pipeline that ensures proper validation, execution, and output handling:
57
57
58
-

58
+

59
59
60
60
This flow demonstrates the coordination between layers and the sophisticated tool execution pipeline that handles both simple completions and complex multi-tool workflows.
Copy file name to clipboardExpand all lines: docs/design/02_Getting_Started.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ The library provides a dependency injection-based architecture where agents, too
23
23
24
24
Agent-swarm-kit uses a layered service architecture built around a central dependency injection container. The system orchestrates multiple AI agents that can communicate, share tools, and maintain conversation history.
Copy file name to clipboardExpand all lines: docs/design/03_Core_Components.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ The agent execution engine consists of two primary components: `ClientAgent` for
15
15
16
16
`ClientAgent` is the core execution engine that processes incoming messages, executes tool calls, and generates AI completions. It implements the `IAgent` interface and serves as the primary orchestrator for agent behavior.
-**Message Execution**: Processes user and tool messages through `execute()` method
@@ -30,7 +30,7 @@ The `ClientAgent` uses a queued execution model to prevent overlapping operation
30
30
31
31
`ClientHistory` manages conversation history for agents, providing filtered message arrays optimized for AI completion contexts and maintaining message persistence.
-**Message Filtering**: Applies agent-specific filters to scope relevant messages
@@ -47,7 +47,7 @@ The history system supports both raw message access and agent-optimized arrays t
47
47
48
48
`ClientSession` orchestrates communication between clients, agents, and swarms while enforcing policies and managing message flows. It implements the `ISession` interface and serves as the primary coordination layer.
The `ClientAgent` follows a structured execution lifecycle with queued processing to prevent overlapping executions. The system supports both stateful execution (via `execute`) and stateless completion (via `run`).
The swarm manages navigation between agents through a navigation stack and active agent tracking. This allows for complex conversation flows where different agents handle different aspects of a conversation.
Swarms integrate with the service architecture through connection services, validation services, and schema services to provide a complete orchestration platform.
Copy file name to clipboardExpand all lines: docs/design/06_Session_and_Chat_Management.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,31 +13,31 @@ For information about individual agent execution within sessions, see [Client Ag
13
13
14
14
Chat management provides a high-level abstraction over sessions with automatic lifecycle management, inactivity detection, and cleanup. The `ChatUtils` class manages multiple `ChatInstance` objects, each wrapping a session with timeout handling and callback support.
The chat layer handles client lifecycle automatically through `beginChat`, `sendMessage`, and `dispose` operations, with configurable callbacks for monitoring chat events and custom chat adapters.
19
19
20
20
## Chat Instance Lifecycle
21
21
22
22
Chat instances manage their lifecycle automatically with inactivity detection and cleanup. The `ChatInstance` class wraps sessions with timeout handling, callback support, and automatic disposal based on activity patterns.
The lifecycle includes automatic cleanup through `INACTIVITY_CHECK` (60 seconds) and `INACTIVITY_TIMEOUT` (15 minutes) constants, with callback hooks for monitoring chat state changes.
27
27
28
28
## Session Lifecycle
29
29
30
30
Sessions follow a managed lifecycle from creation through disposal, with automatic resource tracking and cleanup. The `SessionConnectionService` uses memoization to cache session instances, while validation services track active sessions for proper resource management.
The lifecycle includes initialization callbacks, active message processing, and disposal with proper cleanup. Session validation services ensure that resources are properly tracked and prevent memory leaks in long-running applications.
35
35
36
36
## Message Processing Flow
37
37
38
38
Sessions handle bidirectional message flow with policy validation, agent execution, and event emission. The `emit` method sends messages to clients via swarms, while `execute` processes incoming messages through agents and returns responses.
All message flows include policy validation checkpoints. When validation fails, sessions automatically substitute ban messages and log policy violations through the event system.
43
43
@@ -89,7 +89,7 @@ The session schema extends `ISwarmSessionCallbacks` to provide lifecycle hooks f
89
89
90
90
Sessions coordinate agent execution through swarms, managing the handoff between session-level message processing and agent-level tool execution. The `execute` method delegates to swarm agents while maintaining session context and policy enforcement.
Sessions maintain execution context across agent transitions, ensuring proper client identification and session state preservation during complex multi-agent workflows.
95
95
@@ -117,6 +117,6 @@ Event types include `"emit"`, `"execute"`, `"connect"`, and `"dispose"` with ses
117
117
118
118
Sessions implement comprehensive resource management with automatic cleanup, validation tracking, and memoization clearing. The disposal process ensures proper resource release and prevents memory leaks in long-running applications.
The disposal process includes validation service cleanup, callback execution, and memoization clearing to ensure complete resource release. Sessions automatically handle cleanup of associated agents, histories, and event subscriptions.
The `ClientMCP` constructor initializes the MCP with parameters and triggers the `onInit` callback. Tools are fetched and cached using a memoized function keyed by client ID.
77
77
@@ -118,7 +118,7 @@ The `MCPPublicService` provides a context-aware public API that wraps MCP operat
When a tool returns a string output, it's automatically committed to the agent using `commitToolOutput`. If the tool call is marked as the last in a sequence (`dto.isLast`), the agent execution continues. Error handling stops tool execution and flushes the agent buffer.
0 commit comments