swarms 7.7.1__py3-none-any.whl → 7.7.3__py3-none-any.whl
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.
- swarms/prompts/ag_prompt.py +51 -19
- swarms/prompts/agent_system_prompts.py +13 -4
- swarms/prompts/multi_agent_collab_prompt.py +18 -0
- swarms/prompts/prompt.py +6 -10
- swarms/schemas/__init__.py +0 -3
- swarms/structs/__init__.py +3 -8
- swarms/structs/agent.py +211 -163
- swarms/structs/aop.py +8 -1
- swarms/structs/auto_swarm_builder.py +271 -210
- swarms/structs/conversation.py +23 -56
- swarms/structs/hiearchical_swarm.py +93 -122
- swarms/structs/ma_utils.py +96 -0
- swarms/structs/mixture_of_agents.py +20 -103
- swarms/structs/{multi_agent_orchestrator.py → multi_agent_router.py} +32 -95
- swarms/structs/output_types.py +3 -16
- swarms/structs/stopping_conditions.py +30 -0
- swarms/structs/swarm_router.py +57 -5
- swarms/structs/swarming_architectures.py +576 -185
- swarms/telemetry/main.py +6 -2
- swarms/tools/mcp_client.py +209 -53
- swarms/tools/mcp_integration.py +1 -53
- swarms/utils/formatter.py +15 -1
- swarms/utils/generate_keys.py +64 -0
- swarms/utils/history_output_formatter.py +2 -0
- {swarms-7.7.1.dist-info → swarms-7.7.3.dist-info}/METADATA +98 -263
- {swarms-7.7.1.dist-info → swarms-7.7.3.dist-info}/RECORD +29 -38
- swarms/schemas/agent_input_schema.py +0 -149
- swarms/structs/agents_available.py +0 -87
- swarms/structs/async_workflow.py +0 -818
- swarms/structs/graph_swarm.py +0 -612
- swarms/structs/octotools.py +0 -844
- swarms/structs/pulsar_swarm.py +0 -469
- swarms/structs/queue_swarm.py +0 -193
- swarms/structs/swarm_builder.py +0 -395
- swarms/structs/swarm_load_balancer.py +0 -344
- swarms/structs/swarm_output_type.py +0 -23
- swarms/structs/talk_hier.py +0 -729
- {swarms-7.7.1.dist-info → swarms-7.7.3.dist-info}/LICENSE +0 -0
- {swarms-7.7.1.dist-info → swarms-7.7.3.dist-info}/WHEEL +0 -0
- {swarms-7.7.1.dist-info → swarms-7.7.3.dist-info}/entry_points.txt +0 -0
swarms/prompts/ag_prompt.py
CHANGED
@@ -1,11 +1,52 @@
|
|
1
|
-
from swarms.prompts.prompt import Prompt
|
2
|
-
|
3
1
|
# Aggregator system prompt
|
4
|
-
aggregator_system_prompt = Prompt(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
# aggregator_system_prompt = Prompt(
|
3
|
+
# name="aggregation_prompt",
|
4
|
+
# description="Aggregate and summarize multiple agent outputs",
|
5
|
+
# content="""
|
6
|
+
|
7
|
+
# # Multi-Agent Observer and Summarizer
|
8
|
+
|
9
|
+
# You are an advanced AI agent tasked with observing, analyzing, and summarizing the responses of multiple other AI agents. Your primary function is to provide concise, insightful summaries of agent interactions and outputs. Follow these guidelines:
|
10
|
+
|
11
|
+
# ## Core Responsibilities:
|
12
|
+
# 1. Observe and record responses from all agents in a given interaction.
|
13
|
+
# 2. Analyze the content, tone, and effectiveness of each agent's contribution.
|
14
|
+
# 3. Identify areas of agreement, disagreement, and unique insights among agents.
|
15
|
+
# 4. Summarize key points and conclusions from the multi-agent interaction.
|
16
|
+
# 5. Highlight any inconsistencies, errors, or potential biases in agent responses.
|
17
|
+
|
18
|
+
# ## Operational Guidelines:
|
19
|
+
# - Maintain strict objectivity in your observations and summaries.
|
20
|
+
# - Use clear, concise language in your reports.
|
21
|
+
# - Organize summaries in a structured format for easy comprehension.
|
22
|
+
# - Adapt your summarization style based on the context and complexity of the interaction.
|
23
|
+
# - Respect confidentiality and ethical guidelines in your reporting.
|
24
|
+
|
25
|
+
# ## Analysis Framework:
|
26
|
+
# For each agent interaction, consider the following:
|
27
|
+
# 1. Relevance: How well did each agent address the given task or query?
|
28
|
+
# 2. Accuracy: Were the agents' responses factually correct and logically sound?
|
29
|
+
# 3. Creativity: Did any agents provide unique or innovative perspectives?
|
30
|
+
# 4. Collaboration: How effectively did the agents build upon or challenge each other's ideas?
|
31
|
+
# 5. Efficiency: Which agents provided the most value with the least verbose responses?
|
32
|
+
|
33
|
+
# ## Output Format:
|
34
|
+
# Your summaries should include:
|
35
|
+
# 1. A brief overview of the interaction context
|
36
|
+
# 2. Key points from each agent's contribution
|
37
|
+
# 3. Areas of consensus and disagreement
|
38
|
+
# 4. Notable insights or breakthroughs
|
39
|
+
# 5. Potential improvements or areas for further exploration
|
40
|
+
|
41
|
+
# Remember: Your role is crucial in distilling complex multi-agent interactions into actionable insights. Strive for clarity, accuracy, and impartiality in all your summaries.
|
42
|
+
# """,
|
43
|
+
# )
|
44
|
+
|
45
|
+
|
46
|
+
# # print(aggregator_system_prompt.get_prompt())
|
47
|
+
|
48
|
+
aggregator_system_prompt_main = """
|
49
|
+
|
9
50
|
# Multi-Agent Observer and Summarizer
|
10
51
|
|
11
52
|
You are an advanced AI agent tasked with observing, analyzing, and summarizing the responses of multiple other AI agents. Your primary function is to provide concise, insightful summaries of agent interactions and outputs. Follow these guidelines:
|
@@ -28,7 +69,7 @@ aggregator_system_prompt = Prompt(
|
|
28
69
|
For each agent interaction, consider the following:
|
29
70
|
1. Relevance: How well did each agent address the given task or query?
|
30
71
|
2. Accuracy: Were the agents' responses factually correct and logically sound?
|
31
|
-
3. Creativity:
|
72
|
+
3. Creativity: Div any agents provide unique or innovative perspectives?
|
32
73
|
4. Collaboration: How effectively did the agents build upon or challenge each other's ideas?
|
33
74
|
5. Efficiency: Which agents provided the most value with the least verbose responses?
|
34
75
|
|
@@ -40,14 +81,5 @@ aggregator_system_prompt = Prompt(
|
|
40
81
|
4. Notable insights or breakthroughs
|
41
82
|
5. Potential improvements or areas for further exploration
|
42
83
|
|
43
|
-
|
44
|
-
|
45
|
-
- Identify patterns in agent behaviors and interactions to enhance your analytical capabilities.
|
46
|
-
- Adapt to various domains and types of agent interactions.
|
47
|
-
|
48
|
-
Remember: Your role is crucial in distilling complex multi-agent interactions into actionable insights. Strive for clarity, accuracy, and impartiality in all your summaries.
|
49
|
-
""",
|
50
|
-
)
|
51
|
-
|
52
|
-
|
53
|
-
# print(aggregator_system_prompt.get_prompt())
|
84
|
+
Remember: Your role is crucial in distilling complex mult-agent interactions into actionable insights. Strive for clarity, accuracy, and impartiality in all your summaries.
|
85
|
+
"""
|
@@ -127,9 +127,18 @@ def agent_system_prompt_2(name: str):
|
|
127
127
|
|
128
128
|
|
129
129
|
AGENT_SYSTEM_PROMPT_3 = """
|
130
|
-
You are
|
131
|
-
|
130
|
+
You are an autonomous agent designed to serve users by automating complex tasks, workflows, and activities with precision and intelligence.
|
131
|
+
Agents leverage custom instructions, specialized capabilities, and curated data to optimize large language models for specific domains and use cases.
|
132
132
|
|
133
|
-
You
|
134
|
-
|
133
|
+
You possess the ability to engage in both internal reasoning and external interactions to achieve optimal results.
|
134
|
+
Through self-reflection and user collaboration, you can break down complex problems, identify optimal solutions, and execute tasks with high efficiency.
|
135
|
+
|
136
|
+
Your responses must demonstrate:
|
137
|
+
1. Deep understanding of the task context and requirements
|
138
|
+
2. Logical reasoning and systematic problem-solving
|
139
|
+
3. Clear communication and coherent explanations
|
140
|
+
4. Adaptability to user feedback and changing requirements
|
141
|
+
5. Attention to detail and quality in execution
|
142
|
+
|
143
|
+
Always aim to exceed expectations by delivering comprehensive, well-structured, and contextually appropriate solutions that address both the explicit and implicit needs of the task.
|
135
144
|
"""
|
@@ -311,3 +311,21 @@ These principles guide your interaction with the rest of the system:
|
|
311
311
|
|
312
312
|
|
313
313
|
"""
|
314
|
+
|
315
|
+
|
316
|
+
MULTI_AGENT_COLLAB_PROMPT_TWO = """
|
317
|
+
You are part of a collaborative multi-agent system. Work together to solve complex tasks reliably and efficiently.
|
318
|
+
|
319
|
+
### Core Principles
|
320
|
+
1. **Clarity**: Restate tasks in your own words.
|
321
|
+
2. **Role Awareness**: Know your role and don't assume others' roles.
|
322
|
+
3. **Communication**: Share all relevant information and acknowledge others' inputs.
|
323
|
+
4. **Verification**: Use the 3C Protocol (Completeness, Coherence, Correctness).
|
324
|
+
5. **Reflection**: Continuously evaluate your actions and their impact.
|
325
|
+
|
326
|
+
### Key Protocols
|
327
|
+
- Before acting: Verify if task is already done by others
|
328
|
+
- During execution: Share reasoning and intermediate steps
|
329
|
+
- After completion: Get verification from at least one other agent
|
330
|
+
- Always: Explain your rationale and acknowledge others' contributions
|
331
|
+
"""
|
swarms/prompts/prompt.py
CHANGED
@@ -11,10 +11,6 @@ from pydantic import (
|
|
11
11
|
)
|
12
12
|
from pydantic.v1 import validator
|
13
13
|
|
14
|
-
from swarms.telemetry.main import (
|
15
|
-
capture_system_data,
|
16
|
-
log_agent_data,
|
17
|
-
)
|
18
14
|
from swarms.tools.base_tool import BaseTool
|
19
15
|
from swarms.utils.loguru_logger import initialize_logger
|
20
16
|
|
@@ -141,10 +137,10 @@ class Prompt(BaseModel):
|
|
141
137
|
if self.autosave:
|
142
138
|
self._autosave()
|
143
139
|
|
144
|
-
def log_telemetry(self):
|
145
|
-
|
146
|
-
|
147
|
-
|
140
|
+
# def log_telemetry(self):
|
141
|
+
# system_data = capture_system_data()
|
142
|
+
# merged_data = {**system_data, **self.model_dump()}
|
143
|
+
# log_agent_data(merged_data)
|
148
144
|
|
149
145
|
def rollback(self, version: int) -> None:
|
150
146
|
"""
|
@@ -174,7 +170,7 @@ class Prompt(BaseModel):
|
|
174
170
|
# f"Prompt {self.id} rolled back to version {version}. Current content: '{self.content}'"
|
175
171
|
# )
|
176
172
|
|
177
|
-
self.log_telemetry()
|
173
|
+
# self.log_telemetry()
|
178
174
|
|
179
175
|
if self.autosave:
|
180
176
|
self._autosave()
|
@@ -190,7 +186,7 @@ class Prompt(BaseModel):
|
|
190
186
|
str: The current prompt content.
|
191
187
|
"""
|
192
188
|
# logger.debug(f"Returning prompt {self.id} as a string.")
|
193
|
-
self.log_telemetry()
|
189
|
+
# self.log_telemetry()
|
194
190
|
|
195
191
|
return self.content
|
196
192
|
|
swarms/schemas/__init__.py
CHANGED
swarms/structs/__init__.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
from swarms.structs.agent import Agent
|
2
2
|
from swarms.structs.agent_builder import AgentsBuilder
|
3
|
-
from swarms.structs.agents_available import showcase_available_agents
|
4
|
-
from swarms.structs.async_workflow import AsyncWorkflow
|
5
3
|
from swarms.structs.base_structure import BaseStructure
|
6
4
|
from swarms.structs.base_swarm import BaseSwarm
|
7
5
|
from swarms.structs.base_workflow import BaseWorkflow
|
@@ -48,8 +46,7 @@ from swarms.structs.multi_agent_exec import (
|
|
48
46
|
get_agents_info,
|
49
47
|
get_swarms_info,
|
50
48
|
)
|
51
|
-
from swarms.structs.
|
52
|
-
from swarms.structs.queue_swarm import TaskQueueSwarm
|
49
|
+
from swarms.structs.multi_agent_router import MultiAgentRouter
|
53
50
|
from swarms.structs.rearrange import AgentRearrange, rearrange
|
54
51
|
from swarms.structs.round_robin import RoundRobinSwarm
|
55
52
|
from swarms.structs.sequential_workflow import SequentialWorkflow
|
@@ -80,10 +77,10 @@ from swarms.structs.swarming_architectures import (
|
|
80
77
|
staircase_swarm,
|
81
78
|
star_swarm,
|
82
79
|
)
|
80
|
+
from swarms.structs.auto_swarm_builder import AutoSwarmBuilder
|
83
81
|
|
84
82
|
__all__ = [
|
85
83
|
"Agent",
|
86
|
-
"AsyncWorkflow",
|
87
84
|
"BaseStructure",
|
88
85
|
"BaseSwarm",
|
89
86
|
"BaseWorkflow",
|
@@ -122,7 +119,6 @@ __all__ = [
|
|
122
119
|
"sigmoid_swarm",
|
123
120
|
"staircase_swarm",
|
124
121
|
"star_swarm",
|
125
|
-
"TaskQueueSwarm",
|
126
122
|
"SpreadSheetSwarm",
|
127
123
|
"SwarmRouter",
|
128
124
|
"SwarmType",
|
@@ -136,9 +132,7 @@ __all__ = [
|
|
136
132
|
"run_agent_with_timeout",
|
137
133
|
"run_agents_with_resource_monitoring",
|
138
134
|
"swarm_router",
|
139
|
-
"AsyncWorkflow",
|
140
135
|
"run_agents_with_tasks_concurrently",
|
141
|
-
"showcase_available_agents",
|
142
136
|
"GroupChat",
|
143
137
|
"expertise_based",
|
144
138
|
"MultiAgentRouter",
|
@@ -151,4 +145,5 @@ __all__ = [
|
|
151
145
|
"HybridHierarchicalClusterSwarm",
|
152
146
|
"get_agents_info",
|
153
147
|
"get_swarms_info",
|
148
|
+
"AutoSwarmBuilder",
|
154
149
|
]
|