docs examples groupchat and also swarms of browser use agents

pull/805/head
Kye Gomez 1 week ago
parent 5af454020a
commit cc9ea26aaf

@ -254,12 +254,11 @@ nav:
- Examples:
- Overview: "swarms/examples/unique_swarms.md"
- Swarms API Examples:
- Medical Swarm: "swarms/examples/swarms_api_medical.md"
- Finance Swarm: "swarms/examples/swarms_api_finance.md"
- ML Model Code Generation Swarm: "swarms/examples/swarms_api_ml_model.md"
- Various Model Providers:
- Individal LLM Examples:
- OpenAI: "swarms/examples/openai_example.md"
- Anthropic: "swarms/examples/claude.md"
- Groq: "swarms/examples/groq.md"
@ -278,10 +277,13 @@ nav:
- Quant Crypto Agent: "swarms/examples/quant_crypto_agent.md"
- Meme Agents:
- Bob The Builder: "swarms/examples/bob_the_builder.md"
- Meme Agent Builder: "swarms/examples/meme_agents.md"
- Multi-Agent Collaboration:
- Swarms DAO: "swarms/examples/swarms_dao.md"
- Hybrid Hierarchical-Cluster Swarm Example: "swarms/examples/hhcs_examples.md"
- Group Chat Example: "swarms/examples/groupchat_example.md"
- Meme Agent Builder: "swarms/examples/meme_agents.md"
- External Agents:
- Swarms of Browser Agents: "swarms/examples/swarms_of_browser_agents.md"
- Swarms UI:
- Overview: "swarms/ui/main.md"

@ -0,0 +1,82 @@
# Groupchat Example
- Import required modules
- Configure your agents first
- Set your api keys for your model provider in the `.env` file such as `OPENAI_API_KEY="sk-"`
- Conigure `GroupChat` with it's various settings
## Install
```bash
pip install swarms
```
---------
## Main Code
```python
from dotenv import load_dotenv
import os
from swarms import Agent, GroupChat
if __name__ == "__main__":
load_dotenv()
# Get the OpenAI API key from the environment variable
api_key = os.getenv("OPENAI_API_KEY")
# Example agents
agent1 = Agent(
agent_name="Expense-Analysis-Agent",
description="You are an accounting agent specializing in analyzing potential expenses.",
model_name="gpt-4o-mini",
max_loops=1,
autosave=False,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
output_type="string",
streaming_on=False,
max_tokens=15000,
)
agent2 = Agent(
agent_name="Budget-Adviser-Agent",
description="You are a budget adviser who provides insights on managing and optimizing expenses.",
model_name="gpt-4o-mini",
max_loops=1,
autosave=False,
dashboard=False,
verbose=True,
dynamic_temperature_enabled=True,
user_name="swarms_corp",
retry_attempts=1,
context_length=200000,
output_type="string",
streaming_on=False,
max_tokens=15000,
)
agents = [agent1, agent2]
chat = GroupChat(
name="Expense Advisory",
description="Accounting group focused on discussing potential expenses",
agents=agents,
max_loops=1,
output_type="all",
)
history = chat.run(
"What potential expenses should we consider for the upcoming quarter? Please collaborate to outline a comprehensive list."
)
```

@ -0,0 +1,65 @@
# Swarms x Browser Use
- Import required modules
- Configure your agent first by making a new class
- Set your api keys for your model provider in the `.env` file such as `OPENAI_API_KEY="sk-"`
- Conigure your `ConcurrentWorkflow`
## Install
```bash
pip install swarms browser-use langchain-openai
```
--------
## Main
```python
import asyncio
from browser_use import Agent
from dotenv import load_dotenv
from langchain_openai import ChatOpenAI
from swarms import ConcurrentWorkflow
load_dotenv()
class BrowserAgent:
def __init__(self, agent_name: str = "BrowserAgent"):
self.agent_name = agent_name
async def browser_agent_test(self, task: str):
agent = Agent(
task=task,
llm=ChatOpenAI(model="gpt-4o"),
)
result = await agent.run()
return result
def run(self, task: str):
return asyncio.run(self.browser_agent_test(task))
swarm = ConcurrentWorkflow(
agents=[BrowserAgent() for _ in range(3)],
)
swarm.run(
"""
Go to pump.fun.
2. Make an account: use email: "test@test.com" and password: "test1234"
3. Make a coin called and give it a cool description and etc. Fill in the form
4. Sit back and watch the coin grow in value.
"""
)
```

@ -3,9 +3,6 @@ import os
from swarms.structs.agent import Agent
from swarms.structs.groupchat import GroupChat
from swarms.prompts.multi_agent_collab_prompt import (
MULTI_AGENT_COLLAB_PROMPT_TWO,
)
if __name__ == "__main__":

Loading…
Cancel
Save