From 1a9fb9130d2527b89d3ee1ec4ec90572ce548598 Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sun, 30 Mar 2025 20:02:14 -0700 Subject: [PATCH] sequential_example --- docs/mkdocs.yml | 1 + docs/swarms/examples/sequential_example.md | 57 ++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 docs/swarms/examples/sequential_example.md diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index fa5d9f1f..ab6f5933 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -282,6 +282,7 @@ nav: - 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" + - Sequential Workflow Example: "swarms/examples/sequential_example.md" - External Agents: - Swarms of Browser Agents: "swarms/examples/swarms_of_browser_agents.md" - Swarms UI: diff --git a/docs/swarms/examples/sequential_example.md b/docs/swarms/examples/sequential_example.md new file mode 100644 index 00000000..a4ba993d --- /dev/null +++ b/docs/swarms/examples/sequential_example.md @@ -0,0 +1,57 @@ +# Swarms x Browser Use + +- Import required modules like `Agent` `SequentialWorkflow` + +- Configure your agents first with their model provider, name, description, role, and more! + +- Set your api keys for your model provider in the `.env` file such as `OPENAI_API_KEY="sk-"` etc + +- Conigure your `SequentialWorkflow` + +## Install + +```bash +pip3 install -U swarms +``` +-------- + + + +## Main Code + + +```python +from swarms import Agent, SequentialWorkflow + + +# Core Legal Agent Definitions with enhanced system prompts +litigation_agent = Agent( + agent_name="Alex Johnson", # Human name for the Litigator Agent + system_prompt="As a Litigator, you specialize in navigating the complexities of lawsuits. Your role involves analyzing intricate facts, constructing compelling arguments, and devising effective case strategies to achieve favorable outcomes for your clients.", + model_name="gpt-4o-mini", + max_loops=1, +) + +corporate_agent = Agent( + agent_name="Emily Carter", # Human name for the Corporate Attorney Agent + system_prompt="As a Corporate Attorney, you provide expert legal advice on business law matters. You guide clients on corporate structure, governance, compliance, and transactions, ensuring their business operations align with legal requirements.", + model_name="gpt-4o-mini", + max_loops=1, +) + +ip_agent = Agent( + agent_name="Michael Smith", # Human name for the IP Attorney Agent + system_prompt="As an IP Attorney, your expertise lies in protecting intellectual property rights. You handle various aspects of IP law, including patents, trademarks, copyrights, and trade secrets, helping clients safeguard their innovations.", + model_name="gpt-4o-mini", + max_loops=1, +) + + +swarm = SequentialWorkflow( + agents=[litigation_agent, corporate_agent, ip_agent], + name="litigation-practice", + description="Handle all aspects of litigation with a focus on thorough legal analysis and effective case management.", +) + +swarm.run("Create a report on how to patent an all-new AI invention and what platforms to use and more.") +``` \ No newline at end of file