improve agent docs

pull/1051/head
Kye Gomez 7 days ago
parent 13a3546e59
commit 820c067488

@ -1,13 +0,0 @@
1. make agent api - fastapi
2. make agent cron job
3. agents that listen that could listen to events
4. run on startup, every time the machine starts
4. docker
5. kubernetes
6. aws or google cloud etc
user -> build agent -> user now need deploy agent
FAST

@ -1,17 +1,12 @@
# Agents Introduction # Agents Introduction
The Agent class is the core component of the Swarms framework, designed to create intelligent, autonomous AI agents capable of handling complex tasks through multi-modal processing, tool integration, and structured outputs. This comprehensive guide covers all aspects of the Agent class, from basic setup to advanced features.
## Table of Contents An agent in swarms is basically 4 elements added together:
`agent = LLM + Tools + RAG + Loop`
The Agent class is the core component of the Swarms framework, designed to create intelligent, autonomous AI agents capable of handling complex tasks through multi-modal processing, tool integration, and structured outputs. This comprehensive guide covers all aspects of the Agent class, from basic setup to advanced features.
1. [Prerequisites & Installation](#prerequisites--installation)
2. [Basic Agent Configuration](#basic-agent-configuration)
3. [Multi-Modal Capabilities](#multi-modal-capabilities)
4. [Tool Integration](#tool-integration)
5. [Structured Outputs](#structured-outputs)
6. [Advanced Features](#advanced-features)
7. [Best Practices](#best-practices)
8. [Complete Examples](#complete-examples)
## Prerequisites & Installation ## Prerequisites & Installation
@ -492,57 +487,6 @@ final_only_agent = Agent(
) )
``` ```
### Safety and Content Filtering
```python
from swarms import Agent
# Agent with enhanced safety features
safe_agent = Agent(
agent_name="Safe-Agent",
agent_description="Agent with comprehensive safety measures",
system_prompt="You are a helpful, harmless, and honest AI assistant.",
model_name="gpt-4o-mini",
safety_prompt_on=True, # Enable safety prompts
max_loops=1,
temperature=0.3 # Lower temperature for more consistent, safe responses
)
```
## Best Practices
### Error Handling and Robustness
```python
import logging
from swarms import Agent
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
def robust_agent_execution(agent, task, max_retries=3):
"""Execute agent with retry logic and error handling."""
for attempt in range(max_retries):
try:
response = agent.run(task)
logger.info(f"Agent execution successful on attempt {attempt + 1}")
return response
except Exception as e:
logger.error(f"Attempt {attempt + 1} failed: {str(e)}")
if attempt == max_retries - 1:
raise
time.sleep(2 ** attempt) # Exponential backoff
return None
# Example usage
try:
result = robust_agent_execution(agent, "Analyze market trends")
print(result)
except Exception as e:
print(f"Agent execution failed: {e}")
```
### Performance Optimization ### Performance Optimization
@ -869,15 +813,13 @@ If you encounter issues or need assistance:
We welcome contributions! Here's how to get involved: We welcome contributions! Here's how to get involved:
- **Report Bugs**: Help us improve by reporting issues | Contribution Type | Description |
|-------------------------|--------------------------------------------------|
- **Suggest Features**: Share your ideas for new capabilities | **Report Bugs** | Help us improve by reporting issues |
| **Suggest Features** | Share your ideas for new capabilities |
- **Submit Code**: Contribute improvements and new features | **Submit Code** | Contribute improvements and new features |
| **Improve Documentation** | Help make our docs better |
- **Improve Documentation**: Help make our docs better | **Share Examples** | Show how you're using Swarms in your projects |
- **Share Examples**: Show how you're using Swarms in your projects
--- ---

@ -2,27 +2,23 @@
--- ---
## 🚀 Benefits of Multi-Agent Collaboration ## Benefits of Multi-Agent Collaboration
<div align="center">
<img src="/assets/img/benefits.png" alt="Benefits of Multi-Agent Collaboration" width="700"/>
<br/>
<em>Fig. 1: Key benefits and structure of multi-agent collaboration</em>
</div>
### Why Multi-Agent Architectures? ### Why Multi-Agent Architectures?
Multi-agent systems unlock new levels of intelligence, reliability, and efficiency by enabling agents to work together. Here are the core benefits: Multi-agent systems unlock new levels of intelligence, reliability, and efficiency by enabling agents to work together. Here are the core benefits:
1. **Reduction of Hallucination**: Cross-verification between agents ensures more accurate, reliable outputs by reducing hallucination. | **Benefit** | **Description** |
2. **Extended Memory**: Agents share knowledge and task history, achieving collective long-term memory for smarter, more adaptive responses. |------------------------------------|----------------------------------------------------------------------------------------------------------------------|
3. **Specialization & Task Distribution**: Delegating tasks to specialized agents boosts efficiency and quality. | **Reduction of Hallucination** | Cross-verification between agents ensures more accurate, reliable outputs by reducing hallucination. |
4. **Parallel Processing**: Multiple agents work simultaneously, greatly increasing speed and throughput. | **Extended Memory** | Agents share knowledge and task history, achieving collective long-term memory for smarter, more adaptive responses. |
5. **Scalability & Adaptability**: Systems can dynamically scale and adapt, maintaining efficiency as demands change. | **Specialization & Task Distribution** | Delegating tasks to specialized agents boosts efficiency and quality. |
| **Parallel Processing** | Multiple agents work simultaneously, greatly increasing speed and throughput. |
| **Scalability & Adaptability** | Systems can dynamically scale and adapt, maintaining efficiency as demands change. |
--- ---
## 🏗️ Multi-Agent Architectures For Production Deployments ## Multi-Agent Architectures For Production Deployments
`swarms` provides a variety of powerful, pre-built multi-agent architectures enabling you to orchestrate agents in various ways. Choose the right structure for your specific problem to build efficient and reliable production systems. `swarms` provides a variety of powerful, pre-built multi-agent architectures enabling you to orchestrate agents in various ways. Choose the right structure for your specific problem to build efficient and reliable production systems.
@ -42,7 +38,7 @@ Multi-agent systems unlock new levels of intelligence, reliability, and efficien
--- ---
### 🏢 HierarchicalSwarm Example ### HierarchicalSwarm Example
Hierarchical architectures enable structured, iterative, and scalable problem-solving by combining a director (or router) agent with specialized worker agents or swarms. Below are two key patterns: Hierarchical architectures enable structured, iterative, and scalable problem-solving by combining a director (or router) agent with specialized worker agents or swarms. Below are two key patterns:
@ -292,14 +288,14 @@ Join our community of agent engineers and researchers for technical support, cut
| Platform | Description | Link | | Platform | Description | Link |
|----------|-------------|------| |----------|-------------|------|
| 📚 Documentation | Official documentation and guides | [docs.swarms.world](https://docs.swarms.world) | | Documentation | Official documentation and guides | [docs.swarms.world](https://docs.swarms.world) |
| 📝 Blog | Latest updates and technical articles | [Medium](https://medium.com/@kyeg) | | Blog | Latest updates and technical articles | [Medium](https://medium.com/@kyeg) |
| 💬 Discord | Live chat and community support | [Join Discord](https://discord.gg/EamjgSaEQf) | | Discord | Live chat and community support | [Join Discord](https://discord.gg/EamjgSaEQf) |
| 🐦 Twitter | Latest news and announcements | [@kyegomez](https://twitter.com/kyegomez) | | Twitter | Latest news and announcements | [@kyegomez](https://twitter.com/kyegomez) |
| 👥 LinkedIn | Professional network and updates | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) | | LinkedIn | Professional network and updates | [The Swarm Corporation](https://www.linkedin.com/company/the-swarm-corporation) |
| 📺 YouTube | Tutorials and demos | [Swarms Channel](https://www.youtube.com/channel/UC9yXyitkbU_WSy7bd_41SqQ) | | YouTube | Tutorials and demos | [Swarms Channel](https://www.youtube.com/channel/UC9yXyXyitkbU_WSy7bd_41SqQ) |
| 🎫 Events | Join our community events | [Sign up here](https://lu.ma/5p2jnc2v) | | Events | Join our community events | [Sign up here](https://lu.ma/5p2jnc2v) |
| 🚀 Onboarding Session | Get onboarded with Kye Gomez, creator and lead maintainer of Swarms | [Book Session](https://cal.com/swarms/swarms-onboarding-session) | | Onboarding Session | Get onboarded with Kye Gomez, creator and lead maintainer of Swarms | [Book Session](https://cal.com/swarms/swarms-onboarding-session) |
--- ---

Loading…
Cancel
Save