@ -2216,21 +2217,20 @@ Documentation is located here at: [docs.swarms.world](https://docs.swarms.world)
-----
-----
## Folder Structure
## Folder Structure
The swarms package has been meticlously crafted for extreme use-ability and understanding,the swarms package is split up into various modules such as `swarms.agents` that holds pre-built agents, `swarms.structs` that holds a vast array of structures like `Agent` and multi agent structures. The 3 most important are `structs`, `models`, and `agents`.
The swarms package has been meticulously crafted for extreme usability and understanding,the swarms package is split up into various modules such as `swarms.agents` that holds pre-built agents, `swarms.structs` that holds a vast array of structures like `Agent` and multi agent structures. The package is split into various modules, with the most important being `structs`, `tools`, and `agents`.
Here’s a simple example of creating a financial analysis agent powered by OpenAI’s GPT-4 model. This agent will analyze financial queries like how to set up a ROTH IRA.
Here's a simple example of creating a financial analysis agent powered by OpenAI's GPT-4o-mini model. This agent will analyze financial queries like how to set up a ROTH IRA.
system_prompt="Analyze financial situations and provide advice...",
system_prompt="Analyze financial situations and provide advice...",
llm=model,
max_loops=1,
max_loops=1,
autosave=True,
autosave=True,
dashboard=False,
dashboard=False,
verbose=True,
verbose=True,
saved_state_path="finance_agent.json"
saved_state_path="finance_agent.json",
model_name="gpt-4o-mini",
)
)
# Run the agent on a financial query
# Run your query
out = agent.run("How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?")
out = agent.run(
"How can I establish a ROTH IRA to buy stocks and get a tax break? What are the criteria?"
)
print(out)
print(out)
```
```
@ -57,13 +49,13 @@ print(out)
- **Attributes:**
- **Attributes:**
- `agent_name`: Name of the agent.
- `agent_name`: Name of the agent.
- `system_prompt`: System-level instruction guiding the agent's behavior.
- `system_prompt`: System-level instruction guiding the agent's behavior.
- `llm`: Language model used by the agent (e.g., GPT, Anthropic).
- `model_name`: Name of the model to use (e.g., "gpt-4o-mini").
- `max_loops`: Max iterations for a task.
- `max_loops`: Max iterations for a task.
- `autosave`: Auto-saves the state after each iteration.
- `autosave`: Auto-saves the state after each iteration.
- **Methods:**
- **Methods:**
- `run(task: str)`: Executes the agent’s task.
- `run(task: str)`: Executes the agent's task.
- `ingest_docs(doc_path: str)`: Ingests documents into the agent’s knowledge base.
- `ingest_docs(doc_path: str)`: Ingests documents into the agent's knowledge base.
- `filtered_run(task: str)`: Runs agent with a filtered system prompt.
- `filtered_run(task: str)`: Runs agent with a filtered system prompt.
-----
-----
@ -121,7 +113,7 @@ agents:
### Key Configuration Fields:
### Key Configuration Fields:
- **agent_name**: Name of the agent.
- **agent_name**: Name of the agent.
- **model**: Defines the language model settings (e.g., API key, model name, temperature, and max tokens).
- **model**: Defines the language model settings (e.g., API key, model name, temperature, and max tokens).
- **system_prompt**: The system prompt used to guide the agent’s behavior.
- **system_prompt**: The system prompt used to guide the agent's behavior.
- **task**: (Optional) Task for the agent to execute once created.
- **task**: (Optional) Task for the agent to execute once created.
---
---
@ -248,7 +240,7 @@ Steps:
For example, here's an example on how to create an agent from griptape.
For example, here's an example on how to create an agent from griptape.
Here’s how you can create a custom **Griptape** agent that integrates with the **Swarms** framework by inheriting from the `Agent` class in **Swarms** and overriding the `run(task: str) -> str` method.
Here's how you can create a custom **Griptape** agent that integrates with the **Swarms** framework by inheriting from the `Agent` class in **Swarms** and overriding the `run(task: str) -> str` method.
```python
```python
@ -420,7 +412,7 @@ print(output)
### 5. **Spreadsheet Swarm**
### 5. **Spreadsheet Swarm**
**Overview**: `SpreadSheetSwarm` enables the management of thousands of agents simultaneously, where each agent operates on its own thread. It’s ideal for overseeing large-scale agent outputs.
**Overview**: `SpreadSheetSwarm` enables the management of thousands of agents simultaneously, where each agent operates on its own thread. It's ideal for overseeing large-scale agent outputs.
#### Mermaid Graph:
#### Mermaid Graph:
@ -466,7 +458,7 @@ These are the key swarm architectures available in the **Swarms Framework**. Eac
#### **Workflow Classes**
#### **Workflow Classes**
- **SequentialWorkflow:**
- **SequentialWorkflow:**
- Chains agents, where one agent's output becomes the next agent’s input.
- Chains agents, where one agent's output becomes the next agent's input.
- **AgentRearrange:**
- **AgentRearrange:**
- Dynamically rearranges agent tasks either in parallel or sequentially based on defined flow.
- Dynamically rearranges agent tasks either in parallel or sequentially based on defined flow.