agent-swarm-kit 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +106 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # 🐝 agent-swarm-kit
2
2
 
3
- > A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems
3
+ > A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems. Documentation [available in docs folder](https://github.com/tripolskypetr/agent-swarm-kit/tree/master/docs)
4
+
5
+ ![schema](./schema.png)
4
6
 
5
7
  ## Installation
6
8
 
@@ -10,6 +12,109 @@ In comparison with langchain js this library provide the lightweight API so you
10
12
  npm install agent-swarm-kit
11
13
  ```
12
14
 
15
+ ## The Idea
16
+
17
+ 1. Several chatgpt sessions (agents) [execute tool calls](https://ollama.com/blog/tool-support). Each agent can use different model, for example, [mistral 7b](https://ollama.com/library/mistral) for small talk, [nemotron](https://ollama.com/library/nemotron) for business conversation
18
+
19
+ 2. The agent swarm navigate messages to the active chatgpt session (agent) for each `WebSocket` channel [by using `clientId` url parameter](src/routes/session.ts#L5)
20
+
21
+ 3. The active chatgpt session (agent) in the swarm could be changed [by executing function tool](https://platform.openai.com/docs/assistants/tools/function-calling)
22
+
23
+ 4. Each client sessions [share the same chat message history](https://platform.openai.com/docs/api-reference/messages/getMessage) for all agents. Each client chat history keep the last 25 messages with rotation. Only `assistant` and `user` messages are shared between chatgpt sessions (agents), the `system` and `tool` messages are agent-scoped so each agent knows only those tools related to It. As a result, each chatgpt session (agent) has it's [unique system prompt](https://platform.openai.com/docs/api-reference/messages/createMessage#messages-createmessage-role)
24
+
25
+ 5. If the agent output do not pass the validation (not existing tool call, tool call with invalid arguments, empty output, XML tags in output or JSON in output by default), the resque algorithm will try to fix the model. At first it will hide the previos messeges from a model, if this will not help, it return a placeholder like `Sorry, I missed that. Could you say it again?`
26
+
27
+ ## Test Cases
28
+
29
+ ### Validation Test Cases
30
+
31
+ 1. **Passes validation when all dependencies are provided**
32
+ - Tests if validation passes when all dependencies are present.
33
+
34
+ 2. **Fails validation when swarm is missing**
35
+ - Tests if validation fails when the swarm is missing.
36
+
37
+ 3. **Fails validation when completion is missing**
38
+ - Tests if validation fails when the completion is missing.
39
+
40
+ 4. **Fails validation when agent is missing**
41
+ - Tests if validation fails when the agent is missing.
42
+
43
+ 5. **Fails validation when tool is missing**
44
+ - Tests if validation fails when the tool is missing.
45
+
46
+ 6. **Fails validation when swarm's default agent is not in the list**
47
+ - Tests if validation fails when the swarm's default agent is not included in the list.
48
+
49
+ ### Model Recovery Test Cases
50
+
51
+ 7. **Rescues model on non-existing tool call**
52
+ - Tests if the model can recover when a non-existing tool is called.
53
+
54
+ 8. **Rescues model on empty output**
55
+ - Tests if the model can recover when the output is empty.
56
+
57
+ 9. **Rescues model on failed tool validation**
58
+ - Tests if the model can recover when tool validation fails.
59
+
60
+ 10. **Failed rescue raises a placeholder**
61
+ - Tests if a placeholder is returned when the rescue algorithm fails.
62
+
63
+ ### Navigation Test Cases
64
+
65
+ 11. **Navigates to sales agent on request**
66
+ - Tests if the system navigates to the sales agent upon request.
67
+
68
+ 12. **Navigates to refund agent on request**
69
+ - Tests if the system navigates to the refund agent upon request.
70
+
71
+ ### Deadlock Prevention Test Cases
72
+
73
+ 13. **Avoids deadlock if commitToolOutput was not executed before navigation**
74
+ - Tests if the system avoids deadlock when commitToolOutput is not executed before navigation.
75
+
76
+ 14. **Avoids deadlock when commitToolOutput is executed in parallel with next completion**
77
+ - Tests if the system avoids deadlock when commitToolOutput is executed in parallel with the next completion.
78
+
79
+ ### Agent Execution Test Cases
80
+
81
+ 15. **Ignores execution due to obsolete agent**
82
+ - Tests if the system ignores execution due to an obsolete agent.
83
+
84
+ 16. **Ignores commitToolOutput due to obsolete agent**
85
+ - Tests if the system ignores commitToolOutput due to an obsolete agent.
86
+
87
+ 17. **Ignores commitSystemMessage due to obsolete agent**
88
+ - Tests if the system ignores commitSystemMessage due to an obsolete agent.
89
+
90
+ ### Connection Disposal Test Cases
91
+
92
+ 18. **Disposes connections for session function**
93
+ - Tests if the system disposes of connections for the session function.
94
+
95
+ 19. **Disposes connections for makeConnection function**
96
+ - Tests if the system disposes of connections for the makeConnection function.
97
+
98
+ 20. **Disposes connections for complete function**
99
+ - Tests if the system disposes of connections for the complete function.
100
+
101
+ ### Additional System Behavior Test Cases
102
+
103
+ 21. **Uses different completions on multiple agents**
104
+ - Tests if the system uses different completions for multiple agents.
105
+
106
+ 22. **Clears history for similar clientId after each parallel complete call**
107
+ - Tests if the system clears history for similar clientId after each parallel complete call.
108
+
109
+ 23. **Orchestrates swarms for each connection**
110
+ - Tests if the system orchestrates swarms for each connection.
111
+
112
+ 24. **Queues user messages in connection**
113
+ - Tests if the system queues user messages in connection.
114
+
115
+ 25. **Allows server-side emit for makeConnection**
116
+ - Tests if the system allows server-side emit for makeConnection.
117
+
13
118
  ## Code sample
14
119
 
15
120
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-swarm-kit",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "A TypeScript library for building orchestrated framework-agnostic multi-agent AI systems",
5
5
  "author": {
6
6
  "name": "Petr Tripolsky",