> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lyzr.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents Overview

> Build and manage AI agents with the Lyzr ADK

Agents are AI-powered entities that can understand and respond to messages. Each agent is backed by an LLM provider and can be customized with roles, goals, instructions, and additional features like memory, tools, and RAG.

## Quick Start

```python theme={null}
from lyzr import Studio

studio = Studio(api_key="your-api-key")

# Create an agent
agent = studio.create_agent(
    name="Support Bot",
    provider="gpt-4o",
    role="Customer support agent",
    goal="Help customers resolve issues",
    instructions="Be empathetic, concise, and solution-oriented"
)

# Run the agent
response = agent.run("I can't login to my account")
print(response.response)
```

## Agent Lifecycle

```
Create → Configure → Run → Manage
```

1. **Create**: Use `studio.create_agent()` to create an agent with a name, provider, and configuration
2. **Configure**: Add features like memory, tools, contexts, or RAI policies
3. **Run**: Execute the agent with `agent.run()` to get responses
4. **Manage**: Update, clone, or delete agents as needed

## Key Features

### Provider Selection

Choose from multiple LLM providers:

```python theme={null}
# OpenAI
agent = studio.create_agent(provider="gpt-4o", ...)

# Anthropic
agent = studio.create_agent(provider="claude-sonnet-4.5", ...)

# Google
agent = studio.create_agent(provider="gemini-2.5-pro", ...)

# Full format with provider prefix
agent = studio.create_agent(provider="openai/gpt-4o", ...)
```

### Streaming Responses

Get real-time responses:

```python theme={null}
for chunk in agent.run("Tell me a story", stream=True):
    print(chunk.content, end="", flush=True)
```

### Structured Outputs

Get type-safe responses with Pydantic:

```python theme={null}
from pydantic import BaseModel

class Analysis(BaseModel):
    sentiment: str
    score: float
    summary: str

agent = studio.create_agent(
    name="Analyzer",
    provider="gpt-4o",
    response_model=Analysis
)

result: Analysis = agent.run("Analyze this text...")
print(result.sentiment)  # Type-safe access
```

### Memory

Maintain conversation context:

```python theme={null}
agent = studio.create_agent(
    name="Assistant",
    provider="gpt-4o",
    memory=30  # Remember last 30 messages
)
```

### Knowledge Bases (RAG)

Add document retrieval:

```python theme={null}
kb = studio.create_knowledge_base(name="Docs")
kb.add_pdf("manual.pdf")

response = agent.run(
    "What's in the manual?",
    knowledge_bases=[kb]
)
```

### Tools

Execute Python functions:

```python theme={null}
def get_weather(city: str) -> str:
    """Get weather for a city"""
    return f"72°F in {city}"

agent.add_tool(get_weather)
response = agent.run("What's the weather in NYC?")
```

### RAI Guardrails

Add safety features:

```python theme={null}
policy = studio.create_rai_policy(
    name="SafePolicy",
    toxicity_threshold=0.3
)

agent = studio.create_agent(..., rai_policy=policy)
```

## Agent Properties

| Property       | Type  | Description                   |
| -------------- | ----- | ----------------------------- |
| `id`           | str   | Unique agent identifier       |
| `name`         | str   | Agent name                    |
| `description`  | str   | Agent description             |
| `provider_id`  | str   | LLM provider (e.g., "openai") |
| `model`        | str   | Model name (e.g., "gpt-4o")   |
| `role`         | str   | Agent role                    |
| `goal`         | str   | Agent goal                    |
| `instructions` | str   | Agent instructions            |
| `temperature`  | float | Creativity setting (0.0-2.0)  |
| `top_p`        | float | Nucleus sampling (0.0-1.0)    |

## Next Steps

<Card title="Creating Agents" icon="plus" href="/lyzr-adk/agents/creating-agents">
  Learn all agent creation options
</Card>

<Card title="Running Agents" icon="play" href="/lyzr-adk/agents/running-agents">
  Execute agents and handle responses
</Card>

<Card title="Managing Agents" icon="gear" href="/lyzr-adk/agents/managing-agents">
  Update, clone, and delete agents
</Card>

<Card title="Agent Features" icon="sparkles" href="/lyzr-adk/agents/agent-features">
  Add memory, tools, and more
</Card>
