Update README.md

pull/925/merge
Kye Gomez 4 days ago committed by GitHub
parent ba1437b5dd
commit 77bdaac350
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -714,78 +714,6 @@ Swarm architectures leverage these communication patterns to ensure that agents
| Swarm Router | Routes and chooses the swarm architecture based on the task requirements and available agents. | [Code Link](https://docs.swarms.world/en/latest/swarms/structs/swarm_router/) | Dynamic task routing, adaptive swarm architecture selection, optimized agent allocation |
## Swarms API
We recently launched our enterprise-grade Swarms API. This API allows you to create, manage, and execute swarms from your own application.
#### Steps:
1. Create a Swarms API key [HERE](https://swarms.world)
2. Upload your key to the `.env` file like so: `SWARMS_API_KEY=<your-api-key>`
3. Use the following code to create and execute a swarm:
4. Read our docs for more information for deeper customization [HERE](https://docs.swarms.world/en/latest/swarms_cloud/swarms_api/)
```python
import json
from swarms.structs.swarms_api import (
SwarmsAPIClient,
SwarmRequest,
AgentInput,
)
import os
agents = [
AgentInput(
agent_name="Medical Researcher",
description="Conducts medical research and analysis",
system_prompt="You are a medical researcher specializing in clinical studies.",
max_loops=1,
model_name="gpt-4o",
role="worker",
),
AgentInput(
agent_name="Medical Diagnostician",
description="Provides medical diagnoses based on symptoms and test results",
system_prompt="You are a medical diagnostician with expertise in identifying diseases.",
max_loops=1,
model_name="gpt-4o",
role="worker",
),
AgentInput(
agent_name="Pharmaceutical Expert",
description="Advises on pharmaceutical treatments and drug interactions",
system_prompt="You are a pharmaceutical expert knowledgeable about medications and their effects.",
max_loops=1,
model_name="gpt-4o",
role="worker",
),
]
swarm_request = SwarmRequest(
name="Medical Swarm",
description="A swarm for medical research and diagnostics",
agents=agents,
max_loops=1,
swarm_type="ConcurrentWorkflow",
output_type="str",
return_history=True,
task="What is the cause of the common cold?",
)
client = SwarmsAPIClient(
api_key=os.getenv("SWARMS_API_KEY"), format_type="json"
)
response = client.run(swarm_request)
print(json.dumps(response, indent=4))
```
### `SequentialWorkflow`
The SequentialWorkflow in the Swarms framework enables sequential task execution across multiple Agent objects. Each agent's output serves as input for the next agent in the sequence, continuing until reaching the specified maximum number of loops (max_loops). This workflow is particularly well-suited for tasks requiring a specific order of operations, such as data processing pipelines. To learn more, visit: [Learn More](https://docs.swarms.world/en/latest/swarms/structs/sequential_workflow/)

Loading…
Cancel
Save