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

# Agents

> Let's analyze how Upsonic Agents works

<img src="https://mintcdn.com/upsonic/lEfVQiA3d4Ew-NMK/images/concepts-agent.png?fit=max&auto=format&n=lEfVQiA3d4Ew-NMK&q=85&s=c89102d989b5db9319ba1bdcb3080506" alt="Concepts Agent" width="1728" height="573" data-path="images/concepts-agent.png" />

Generate agents that belongs to your company.

The `Agent` class is the core agent implementation in Upsonic, providing a powerful and flexible interface for creating AI agents with advanced capabilities including memory management, safety policies, reliability layers, and sophisticated tool integration.

## Overview

The `Agent` can be created with minimal configuration or with extensive customization to suit your specific needs. The agent provides a robust foundation for AI-powered applications with built-in support for various advanced features.

## Key Features

* **Memory Management**: Built-in support for session memory, user profiles, and conversation history
* **Safety Policies**: Configurable user and agent policies for content filtering and validation
* **Reliability Layer**: Advanced hallucination prevention and content validation
* **Tool Integration**: Sophisticated tool processing with behavioral wrappers
* **Thinking & Reasoning**: Optional advanced reasoning capabilities for complex tasks
* **Multi-Model Support**: Works with OpenAI, Anthropic, Google, and others!
* **Streaming**: Real-time response streaming for better user experience
* **Caching**: Built-in caching system for improved performance
* **Canvas Integration**: Support for persistent text editing and collaboration

## Example

### Basic Example

```python theme={null}
from upsonic import Agent, Task

# Create an agent
agent = Agent("anthropic/claude-sonnet-4-5")

# Execute with Task object
task = Task("What is 2 + 2?")
agent.print_do(task)
# agent.do(task)

# Or execute directly with a string (auto-converted to Task)
agent.print_do("What is 2 + 2?")
# agent.do("What is 2 + 2?")
```

<Warning>
  When creating an agent without specifying a model, it defaults to `"openai/gpt-4o"`. Make sure you have the appropriate API key set in your environment.
</Warning>

### Deep Agent Example

```python theme={null}
import asyncio
from upsonic.agent.deepagent import DeepAgent
from upsonic import Task

async def main():
    # Create a deep agent
    agent = DeepAgent(model="anthropic/claude-sonnet-4-5")
    
    # Create a complex task
    task = Task(
        description="Research Python web frameworks and create a comparison report. Save findings to /research/frameworks.txt and create /reports/comparison.txt"
    )
    
    # Execute - agent will automatically create todos and manage the workflow
    await agent.print_do_async(task)
    # await agent.do_async(task)
    
    # Check files created
    files = await agent.filesystem_backend.glob("/**/*.txt")
    print(f"Files created: {files}")

asyncio.run(main())
```

## Navigation

* [Creating an Agent](/concepts/agents/creating-an-agent) - Learn how to create agents with different configurations
* [Agent Attributes](/concepts/agents/attributes) - Comprehensive guide to all agent configuration options
* [Adding a Memory](/concepts/agents/advanced/adding-a-memory) - Set up memory management for your agents
* [Adding Thinking](/concepts/agents/advanced/adding-thinking) - Enable thinking capabilities for your agents
* [Adding Reasoning](/concepts/agents/advanced/adding-reasoning) - Enable advanced reasoning for complex tasks
