agent-squad 1.0.0__tar.gz
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.
- agent_squad-1.0.0/LICENSE +202 -0
- agent_squad-1.0.0/PKG-INFO +302 -0
- agent_squad-1.0.0/README.md +273 -0
- agent_squad-1.0.0/pyproject.toml +3 -0
- agent_squad-1.0.0/setup.cfg +46 -0
- agent_squad-1.0.0/setup.py +3 -0
- agent_squad-1.0.0/src/agent_squad/__init__.py +3 -0
- agent_squad-1.0.0/src/agent_squad/agents/__init__.py +81 -0
- agent_squad-1.0.0/src/agent_squad/agents/agent.py +181 -0
- agent_squad-1.0.0/src/agent_squad/agents/amazon_bedrock_agent.py +172 -0
- agent_squad-1.0.0/src/agent_squad/agents/anthropic_agent.py +331 -0
- agent_squad-1.0.0/src/agent_squad/agents/bedrock_flows_agent.py +115 -0
- agent_squad-1.0.0/src/agent_squad/agents/bedrock_inline_agent.py +346 -0
- agent_squad-1.0.0/src/agent_squad/agents/bedrock_llm_agent.py +376 -0
- agent_squad-1.0.0/src/agent_squad/agents/bedrock_translator_agent.py +139 -0
- agent_squad-1.0.0/src/agent_squad/agents/chain_agent.py +86 -0
- agent_squad-1.0.0/src/agent_squad/agents/comprehend_filter_agent.py +163 -0
- agent_squad-1.0.0/src/agent_squad/agents/lambda_agent.py +86 -0
- agent_squad-1.0.0/src/agent_squad/agents/lex_bot_agent.py +71 -0
- agent_squad-1.0.0/src/agent_squad/agents/openai_agent.py +211 -0
- agent_squad-1.0.0/src/agent_squad/agents/supervisor_agent.py +290 -0
- agent_squad-1.0.0/src/agent_squad/classifiers/__init__.py +45 -0
- agent_squad-1.0.0/src/agent_squad/classifiers/anthropic_classifier.py +100 -0
- agent_squad-1.0.0/src/agent_squad/classifiers/bedrock_classifier.py +136 -0
- agent_squad-1.0.0/src/agent_squad/classifiers/classifier.py +181 -0
- agent_squad-1.0.0/src/agent_squad/classifiers/openai_classifier.py +108 -0
- agent_squad-1.0.0/src/agent_squad/orchestrator.py +349 -0
- agent_squad-1.0.0/src/agent_squad/retrievers/__init__.py +8 -0
- agent_squad-1.0.0/src/agent_squad/retrievers/amazon_kb_retriever.py +55 -0
- agent_squad-1.0.0/src/agent_squad/retrievers/retriever.py +61 -0
- agent_squad-1.0.0/src/agent_squad/shared/__init__.py +0 -0
- agent_squad-1.0.0/src/agent_squad/shared/user_agent.py +208 -0
- agent_squad-1.0.0/src/agent_squad/shared/version.py +3 -0
- agent_squad-1.0.0/src/agent_squad/storage/__init__.py +35 -0
- agent_squad-1.0.0/src/agent_squad/storage/chat_storage.py +121 -0
- agent_squad-1.0.0/src/agent_squad/storage/dynamodb_chat_storage.py +209 -0
- agent_squad-1.0.0/src/agent_squad/storage/in_memory_chat_storage.py +116 -0
- agent_squad-1.0.0/src/agent_squad/storage/sql_chat_storage.py +302 -0
- agent_squad-1.0.0/src/agent_squad/types/__init__.py +36 -0
- agent_squad-1.0.0/src/agent_squad/types/types.py +74 -0
- agent_squad-1.0.0/src/agent_squad/utils/__init__.py +12 -0
- agent_squad-1.0.0/src/agent_squad/utils/helpers.py +34 -0
- agent_squad-1.0.0/src/agent_squad/utils/logger.py +106 -0
- agent_squad-1.0.0/src/agent_squad/utils/tool.py +256 -0
- agent_squad-1.0.0/src/agent_squad.egg-info/PKG-INFO +302 -0
- agent_squad-1.0.0/src/agent_squad.egg-info/SOURCES.txt +48 -0
- agent_squad-1.0.0/src/agent_squad.egg-info/dependency_links.txt +1 -0
- agent_squad-1.0.0/src/agent_squad.egg-info/requires.txt +18 -0
- agent_squad-1.0.0/src/agent_squad.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agent_squad
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Agent Squad framework
|
|
5
|
+
Home-page: https://github.com/awslabs/agent-squad
|
|
6
|
+
Author: Anthony Bernabeu, Corneliu Croitoru
|
|
7
|
+
Author-email: brnaba@amazon.com, ccroito@amazon.com
|
|
8
|
+
License: Apache License 2.0
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Provides-Extra: aws
|
|
16
|
+
Requires-Dist: boto3>=1.36.18; extra == "aws"
|
|
17
|
+
Provides-Extra: anthropic
|
|
18
|
+
Requires-Dist: anthropic>=0.40.0; extra == "anthropic"
|
|
19
|
+
Provides-Extra: openai
|
|
20
|
+
Requires-Dist: openai>=1.55.3; extra == "openai"
|
|
21
|
+
Provides-Extra: sql
|
|
22
|
+
Requires-Dist: libsql-client>=0.3.1; extra == "sql"
|
|
23
|
+
Provides-Extra: all
|
|
24
|
+
Requires-Dist: anthropic>=0.40.0; extra == "all"
|
|
25
|
+
Requires-Dist: openai>=1.55.3; extra == "all"
|
|
26
|
+
Requires-Dist: boto3>=1.36.18; extra == "all"
|
|
27
|
+
Requires-Dist: libsql-client>=0.3.1; extra == "all"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
<h2 align="center">Agent Squad </h2>
|
|
31
|
+
|
|
32
|
+
<p align="center">Flexible and powerful framework for managing multiple AI agents and handling complex conversations.</p>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<a href="https://github.com/awslabs/agent-squad"><img alt="GitHub Repo" src="https://img.shields.io/badge/GitHub-Repo-green.svg" /></a>
|
|
37
|
+
<a href="https://pypi.org/project/agent-squad/"><img alt="PyPI" src="https://img.shields.io/pypi/v/agent-squad.svg?style=flat-square"></a>
|
|
38
|
+
<a href="https://awslabs.github.io/agent-squad/"><img alt="Documentation" src="https://img.shields.io/badge/docs-book-blue.svg?style=flat-square"></a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<!-- GitHub Stats -->
|
|
43
|
+
<img src="https://img.shields.io/github/stars/awslabs/agent-squad?style=social" alt="GitHub stars">
|
|
44
|
+
<img src="https://img.shields.io/github/forks/awslabs/agent-squad?style=social" alt="GitHub forks">
|
|
45
|
+
<img src="https://img.shields.io/github/watchers/awslabs/agent-squad?style=social" alt="GitHub watchers">
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<!-- Repository Info -->
|
|
50
|
+
<img src="https://img.shields.io/github/last-commit/awslabs/agent-squad" alt="Last Commit">
|
|
51
|
+
<img src="https://img.shields.io/github/issues/awslabs/agent-squad" alt="Issues">
|
|
52
|
+
<img src="https://img.shields.io/github/issues-pr/awslabs/agent-squad" alt="Pull Requests">
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<p align="center">
|
|
56
|
+
<!-- Package Stats -->
|
|
57
|
+
<a href="https://pypi.org/project/agent-squad/"><img src="https://img.shields.io/pypi/dm/agent-squad?label=pypi%20downloads" alt="PyPI Monthly Downloads"></a>
|
|
58
|
+
<img src="https://img.shields.io/static/v1?label=python&message=%203.11|%203.12|%203.13&color=blue?style=flat-square&logo=python" alt="Python versions">
|
|
59
|
+
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
## 🔖 Features
|
|
63
|
+
|
|
64
|
+
- 🧠 **Intelligent intent classification** — Dynamically route queries to the most suitable agent based on context and content.
|
|
65
|
+
- 🌊 **Flexible agent responses** — Support for both streaming and non-streaming responses from different agents.
|
|
66
|
+
- 📚 **Context management** — Maintain and utilize conversation context across multiple agents for coherent interactions.
|
|
67
|
+
- 🔧 **Extensible architecture** — Easily integrate new agents or customize existing ones to fit your specific needs.
|
|
68
|
+
- 🌐 **Universal deployment** — Run anywhere - from AWS Lambda to your local environment or any cloud platform.
|
|
69
|
+
- 📦 **Pre-built agents and classifiers** — A variety of ready-to-use agents and multiple classifier implementations available.
|
|
70
|
+
- 🔤 **TypeScript support** — Native TypeScript implementation available.
|
|
71
|
+
|
|
72
|
+
## What's the Agent Squad ❓
|
|
73
|
+
|
|
74
|
+
The Agent Squad is a flexible framework for managing multiple AI agents and handling complex conversations. It intelligently routes queries and maintains context across interactions.
|
|
75
|
+
|
|
76
|
+
The system offers pre-built components for quick deployment, while also allowing easy integration of custom agents and conversation messages storage solutions.
|
|
77
|
+
|
|
78
|
+
This adaptability makes it suitable for a wide range of applications, from simple chatbots to sophisticated AI systems, accommodating diverse requirements and scaling efficiently.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## 🏗️ High-level architecture flow diagram
|
|
82
|
+
|
|
83
|
+
<br /><br />
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
<br /><br />
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
1. The process begins with user input, which is analyzed by a Classifier.
|
|
91
|
+
2. The Classifier leverages both Agents' Characteristics and Agents' Conversation history to select the most appropriate agent for the task.
|
|
92
|
+
3. Once an agent is selected, it processes the user input.
|
|
93
|
+
4. The orchestrator then saves the conversation, updating the Agents' Conversation history, before delivering the response back to the user.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## 💬 Demo App
|
|
97
|
+
|
|
98
|
+
To quickly get a feel for the Agent Squad, we've provided a Demo App with a few basic agents. This interactive demo showcases the orchestrator's capabilities in a user-friendly interface. To learn more about setting up and running the demo app, please refer to our [Demo App](https://awslabs.github.io/agent-squad/cookbook/examples/chat-demo-app/) section.
|
|
99
|
+
|
|
100
|
+
<br>
|
|
101
|
+
|
|
102
|
+
In the screen recording below, we demonstrate an extended version of the demo app that uses 6 specialized agents:
|
|
103
|
+
- **Travel Agent**: Powered by an Amazon Lex Bot
|
|
104
|
+
- **Weather Agent**: Utilizes a Bedrock LLM Agent with a tool to query the open-meteo API
|
|
105
|
+
- **Restaurant Agent**: Implemented as an Amazon Bedrock Agent
|
|
106
|
+
- **Math Agent**: Utilizes a Bedrock LLM Agent with two tools for executing mathematical operations
|
|
107
|
+
- **Tech Agent**: A Bedrock LLM Agent designed to answer questions on technical topics
|
|
108
|
+
- **Health Agent**: A Bedrock LLM Agent focused on addressing health-related queries
|
|
109
|
+
|
|
110
|
+
Watch as the system seamlessly switches context between diverse topics, from booking flights to checking weather, solving math problems, and providing health information.
|
|
111
|
+
Notice how the appropriate agent is selected for each query, maintaining coherence even with brief follow-up inputs.
|
|
112
|
+
|
|
113
|
+
The demo highlights the system's ability to handle complex, multi-turn conversations while preserving context and leveraging specialized agents across various domains.
|
|
114
|
+
|
|
115
|
+
Click on the image below to see a screen recording of the demo app on the GitHub repository of the project:
|
|
116
|
+
<a href="https://github.com/awslabs/agent-squad" target="_blank">
|
|
117
|
+
<img src="https://raw.githubusercontent.com/awslabs/agent-squad/main/img/demo-app.jpg" alt="Demo App Screen Recording" style="max-width: 100%; height: auto;">
|
|
118
|
+
</a>
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## 🚀 Getting Started
|
|
123
|
+
|
|
124
|
+
Check out our [documentation](https://awslabs.github.io/agent-squad/) for comprehensive guides on setting up and using the Agent Squad!
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
### Core Installation
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Optional: Set up a virtual environment
|
|
132
|
+
python -m venv venv
|
|
133
|
+
source venv/bin/activate # On Windows use `venv\Scripts\activate`
|
|
134
|
+
pip install agent-squad[aws]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Default Usage
|
|
138
|
+
|
|
139
|
+
Here's an equivalent Python example demonstrating the use of the Agent Squad with a Bedrock LLM Agent and a Lex Bot Agent:
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
import sys
|
|
143
|
+
import asyncio
|
|
144
|
+
from agent_squad.orchestrator import AgentSquad
|
|
145
|
+
from agent_squad.agents import BedrockLLMAgent, LexBotAgent, BedrockLLMAgentOptions, LexBotAgentOptions, AgentStreamResponse
|
|
146
|
+
|
|
147
|
+
orchestrator = AgentSquad()
|
|
148
|
+
|
|
149
|
+
tech_agent = BedrockLLMAgent(BedrockLLMAgentOptions(
|
|
150
|
+
name="Tech Agent",
|
|
151
|
+
streaming=True,
|
|
152
|
+
description="Specializes in technology areas including software development, hardware, AI, \
|
|
153
|
+
cybersecurity, blockchain, cloud computing, emerging tech innovations, and pricing/costs \
|
|
154
|
+
related to technology products and services.",
|
|
155
|
+
model_id="anthropic.claude-3-sonnet-20240229-v1:0",
|
|
156
|
+
))
|
|
157
|
+
orchestrator.add_agent(tech_agent)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
health_agent = BedrockLLMAgent(BedrockLLMAgentOptions(
|
|
161
|
+
name="Health Agent",
|
|
162
|
+
streaming=True,
|
|
163
|
+
description="Specializes in health and well being",
|
|
164
|
+
))
|
|
165
|
+
orchestrator.add_agent(health_agent)
|
|
166
|
+
|
|
167
|
+
async def main():
|
|
168
|
+
# Example usage
|
|
169
|
+
response = await orchestrator.route_request(
|
|
170
|
+
"What is AWS Lambda?",
|
|
171
|
+
'user123',
|
|
172
|
+
'session456',
|
|
173
|
+
{},
|
|
174
|
+
True
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
# Handle the response (streaming or non-streaming)
|
|
178
|
+
if response.streaming:
|
|
179
|
+
print("\n** RESPONSE STREAMING ** \n")
|
|
180
|
+
# Send metadata immediately
|
|
181
|
+
print(f"> Agent ID: {response.metadata.agent_id}")
|
|
182
|
+
print(f"> Agent Name: {response.metadata.agent_name}")
|
|
183
|
+
print(f"> User Input: {response.metadata.user_input}")
|
|
184
|
+
print(f"> User ID: {response.metadata.user_id}")
|
|
185
|
+
print(f"> Session ID: {response.metadata.session_id}")
|
|
186
|
+
print(f"> Additional Parameters: {response.metadata.additional_params}")
|
|
187
|
+
print("\n> Response: ")
|
|
188
|
+
|
|
189
|
+
# Stream the content
|
|
190
|
+
async for chunk in response.output:
|
|
191
|
+
async for chunk in response.output:
|
|
192
|
+
if isinstance(chunk, AgentStreamResponse):
|
|
193
|
+
print(chunk.text, end='', flush=True)
|
|
194
|
+
else:
|
|
195
|
+
print(f"Received unexpected chunk type: {type(chunk)}", file=sys.stderr)
|
|
196
|
+
|
|
197
|
+
else:
|
|
198
|
+
# Handle non-streaming response (AgentProcessingResult)
|
|
199
|
+
print("\n** RESPONSE ** \n")
|
|
200
|
+
print(f"> Agent ID: {response.metadata.agent_id}")
|
|
201
|
+
print(f"> Agent Name: {response.metadata.agent_name}")
|
|
202
|
+
print(f"> User Input: {response.metadata.user_input}")
|
|
203
|
+
print(f"> User ID: {response.metadata.user_id}")
|
|
204
|
+
print(f"> Session ID: {response.metadata.session_id}")
|
|
205
|
+
print(f"> Additional Parameters: {response.metadata.additional_params}")
|
|
206
|
+
print(f"\n> Response: {response.output.content}")
|
|
207
|
+
|
|
208
|
+
if __name__ == "__main__":
|
|
209
|
+
asyncio.run(main())
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
The following example demonstrates how to use the Agent Squad with two different types of agents: a Bedrock LLM Agent with Converse API support and a Lex Bot Agent. This showcases the flexibility of the system in integrating various AI services.
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
This example showcases:
|
|
219
|
+
1. The use of a Bedrock LLM Agent with Converse API support, allowing for multi-turn conversations.
|
|
220
|
+
2. Integration of a Lex Bot Agent for specialized tasks (in this case, travel-related queries).
|
|
221
|
+
3. The orchestrator's ability to route requests to the most appropriate agent based on the input.
|
|
222
|
+
4. Handling of both streaming and non-streaming responses from different types of agents.
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
### Working with Anthropic or OpenAI
|
|
226
|
+
If you want to use Anthropic or OpenAI for classifier and/or agents, make sure to install the agent-squad with the relevant extra feature.
|
|
227
|
+
```bash
|
|
228
|
+
pip install "agent-squad[anthropic]"
|
|
229
|
+
pip install "agent-squad[openai]"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Full package installation
|
|
233
|
+
For a complete installation (including Anthropic and OpenAi):
|
|
234
|
+
```bash
|
|
235
|
+
pip install agent-squad[all]
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Building Locally
|
|
239
|
+
|
|
240
|
+
This guide explains how to build and install the agent-squad package from source code.
|
|
241
|
+
|
|
242
|
+
### Prerequisites
|
|
243
|
+
|
|
244
|
+
- Python 3.11
|
|
245
|
+
- pip package manager
|
|
246
|
+
- Git (to clone the repository)
|
|
247
|
+
|
|
248
|
+
### Building the Package
|
|
249
|
+
|
|
250
|
+
1. Navigate to the Python package directory:
|
|
251
|
+
```bash
|
|
252
|
+
cd python
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
2. Install the build dependencies:
|
|
256
|
+
```bash
|
|
257
|
+
python -m pip install build
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
3. Build the package:
|
|
261
|
+
```bash
|
|
262
|
+
python -m build
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
This process will create distribution files in the `python/dist` directory, including a wheel (`.whl`) file.
|
|
266
|
+
|
|
267
|
+
### Installation
|
|
268
|
+
|
|
269
|
+
1. Locate the current version number in `setup.cfg`.
|
|
270
|
+
|
|
271
|
+
2. Install the built package using pip:
|
|
272
|
+
```bash
|
|
273
|
+
pip install ./dist/agent_squad-<VERSION>-py3-none-any.whl
|
|
274
|
+
```
|
|
275
|
+
Replace `<VERSION>` with the version number from `setup.cfg`.
|
|
276
|
+
|
|
277
|
+
### Example
|
|
278
|
+
|
|
279
|
+
If the version in `setup.cfg` is `1.2.3`, the installation command would be:
|
|
280
|
+
```bash
|
|
281
|
+
pip install ./dist/agent_squad-1.2.3-py3-none-any.whl
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### Troubleshooting
|
|
285
|
+
|
|
286
|
+
- If you encounter permission errors during installation, you may need to use `sudo` or activate a virtual environment.
|
|
287
|
+
- Make sure you're in the correct directory when running the build and install commands.
|
|
288
|
+
- Clean the `dist` directory before rebuilding if you encounter issues: `rm -rf python/dist/*`
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
## 🤝 Contributing
|
|
293
|
+
|
|
294
|
+
We welcome contributions! Please see our [Contributing Guide](https://raw.githubusercontent.com/awslabs/agent-squad/main/CONTRIBUTING.md) for more details.
|
|
295
|
+
|
|
296
|
+
## 📄 LICENSE
|
|
297
|
+
|
|
298
|
+
This project is licensed under the Apache 2.0 licence - see the [LICENSE](https://raw.githubusercontent.com/awslabs/agent-squad/main/LICENSE) file for details.
|
|
299
|
+
|
|
300
|
+
## 📄 Font License
|
|
301
|
+
This project uses the JetBrainsMono NF font, licensed under the SIL Open Font License 1.1.
|
|
302
|
+
For full license details, see [FONT-LICENSE.md](https://github.com/JetBrains/JetBrainsMono/blob/master/OFL.txt).
|