> For the complete documentation index, see [llms.txt](https://nuvex-ai.gitbook.io/nuvex-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nuvex-ai.gitbook.io/nuvex-ai/developer-guide/quick-start-guide.md).

# Quick Start Guide

**Build Your First Agent in 5 Minutes**

Welcome to **Nuvex** — the easiest way to create, run, and scale intelligent agents in Web3.\
This guide will walk you through setting up your first Nuvex agent in just a few minutes.

***

#### **Prerequisites**

Before you begin, ensure you have:

* Python 3.11+
* `pip` or `poetry` installed
* A basic understanding of Python
* An API key for your preferred LLM (OpenAI, Claude, etc.)

***

#### **Installation**

```bash
# Using pip
pip install nuvex

# Or using poetry
poetry add nuvex
```

***

#### 1. **Create Your First Agent**

```python
from nuvex import Agent

# Initialize a simple agent
agent = Agent(
    name="my_first_agent",
    description="A helpful assistant",
    model="gpt-4"  # or any supported model
)

# Start a conversation
response = agent.chat("Hello! Can you help me with some data analysis?")
print(response)
```

***

#### 2. **Add Tools to Your Agent**

```python
from nuvex.tools import Calculator, WebSearch

agent = Agent(
    name="powered_agent",
    description="An agent that can calculate and search",
    model="gpt-4",
    tools=[Calculator(), WebSearch()]
)

response = agent.chat("What is the square root of 144 plus the current temperature in New York?")
print(response)
```

***

#### 3. **Create a Custom Tool**

```python
from nuvex.tools import BaseTool

class WeatherTool(BaseTool):
    def __init__(self):
        super().__init__(
            name="weather",
            description="Get weather information"
        )

    async def _run(self, location: str) -> str:
        # Implement weather logic here
        return f"Weather information for {location}"

agent = Agent(
    name="weather_agent",
    tools=[WeatherTool()]
)
```

***

#### 4. **Multi-Agent Collaboration**

```python
from nuvex import Agent, Team

# Create specialized agents
researcher = Agent(name="researcher", tools=["web_search"])
analyst = Agent(name="analyst", tools=["calculator"])
writer = Agent(name="writer", tools=["text_processor"])

# Create a team
team = Team(
    name="research_team",
    agents=[researcher, analyst, writer]
)

# Collaborate on a task
result = team.collaborate("Research the impact of AI on healthcare and prepare a report")
```

***

#### 5. **Deploy Your Agent**

```python
from nuvex.deploy import APIServer

server = APIServer(agents=[agent])
server.run(host="localhost", port=8000)
```

You can now interact with your agent via REST API:

```bash
curl -X POST http://localhost:8000/chat \
    -H "Content-Type: application/json" \
    -d '{"message": "Hello, agent!"}'
```

***

### **Next Steps**

#### Explore More Features

* Add memory management
* Create agent teams
* Implement custom workflows
* Add authentication layers
* Monitor performance

#### Advanced Topics

* Integrate custom models
* Build advanced tools
* Enable multi-agent orchestration
* Optimize for performance and latency
* Harden agent security

***

### **Best Practices**

* Handle errors gracefully
* Monitor agent behavior
* Rate limit sensitive endpoints
* Encrypt API keys and credentials
* Test each agent scenario thoroughly

***

### **Common Use Cases**

**Customer Service**

```python
service_agent = Agent(
    name="customer_service",
    description="Handles support tickets and FAQs",
    tools=["faq", "ticket_system", "email"]
)
```

**Data Analysis**

```python
analysis_agent = Agent(
    name="data_analyst",
    description="Performs quantitative analysis",
    tools=["pandas", "matplotlib", "database"]
)
```

**Content Creation**

```python
content_agent = Agent(
    name="content_creator",
    description="Writes and formats creative content",
    tools=["text_generator", "image_creator"]
)
```

***

### **Troubleshooting**

**Model API Fallback**

```python
agent = Agent(
    name="reliable_agent",
    model="gpt-4",
    fallback_model="gpt-3.5-turbo"
)
```

**Rate Limiting**

```python
agent = Agent(
    name="controlled_agent",
    rate_limit=10,  # max requests
    rate_limit_period=60  # per minute
)
```

**Memory Management**

```python
agent = Agent(
    name="memory_efficient",
    max_memory_tokens=1000,
    memory_type="sliding_window"
)
```
