# Upsonic

> Build autonomous and traditional AI agents in Python

- Category: Agents & Automation / Agent Frameworks & Builders
- Language: Python
- Licence: MIT
- Repository: https://github.com/Upsonic/Upsonic
- Website: https://upsonic.ai
- Canonical page: https://ai-tldr.dev/tools/upsonic/

## In short

Upsonic is an open-source Python framework for building AI agents. It supports both autonomous agents, which run multi-step tasks on their own, and more traditional agents that you drive task by task. It sits in the Agent Frameworks & Builders category of the Agents & Automation tools and is open-source, written in Python and licensed MIT.

## Overview

Upsonic is an open-source Python framework for building AI agents. It supports both autonomous agents, which run multi-step tasks on their own, and more traditional agents that you drive task by task. You describe what you want as a Task and hand it to an Agent, which calls a language model and any tools you give it.

It is aimed at Python developers who want to wire agents into real workflows without building the orchestration plumbing themselves. Autonomous agents restrict file and shell operations to a defined workspace, blocking path traversal and dangerous commands, which makes them safer to point at log analysis or other system tasks.

As a general agent framework, Upsonic covers the common building blocks: model selection, custom tools, MCP integration, prebuilt community agents, and an optional OCR pipeline for pulling text out of PDFs and images.

## What it does

- Two agent styles: AutonomousAgent for self-directed multi-step tasks and Agent for step-by-step traditional workflows
- Custom tools defined with a simple @tool decorator on typed Python functions
- Sandboxed workspaces for autonomous agents that block path traversal and dangerous shell commands
- Prebuilt, community-contributed autonomous agents that run from install in seconds
- MCP tools integration to connect agents to external data sources and services
- Optional OCR pipeline with multiple engines (EasyOCR, RapidOCR, Tesseract, PaddleOCR, DeepSeek OCR)

## Getting started

Install Upsonic, then run either an autonomous or a traditional agent against a task.

1. Install Upsonic

   Install the package with uv (or pip).

```bash
uv pip install upsonic
# pip install upsonic
```

2. Run a traditional agent

   Create an Agent with a model, wrap your instruction in a Task, and call print_do.

```python
from upsonic import Agent, Task

agent = Agent(model="anthropic/claude-sonnet-4-5", name="Stock Analyst Agent")

task = Task(description="Analyze the current market trends")

agent.print_do(task)
```

3. Add a custom tool

   Decorate a typed function with @tool and pass it to a Task via the tools argument.

```python
from upsonic import Agent, Task
from upsonic.tools import tool

@tool
def sum_tool(a: float, b: float) -> float:
    """
    Add two numbers together.

    Args:
        a: First number
        b: Second number

    Returns:
        The sum of a and b
    """
    return a + b

task = Task(
    description="Calculate 15 + 27",
    tools=[sum_tool]
)

agent = Agent(model="anthropic/claude-sonnet-4-5", name="Calculator Agent")

result = agent.print_do(task)
```

4. Run an autonomous agent

   Give an AutonomousAgent a model and a workspace; file and shell operations stay restricted to that workspace.

```python
from upsonic import AutonomousAgent, Task

agent = AutonomousAgent(
    model="anthropic/claude-sonnet-4-5",
    workspace="/path/to/logs"
)

task = Task("Analyze server logs and detect anomaly patterns")

agent.print_do(task)
```

## When to use it

- Run an autonomous agent over a workspace to analyze server logs and surface anomaly patterns
- Build a task-driven agent that calls your own Python functions as tools
- Extract text from scanned PDFs and images using the optional OCR pipeline
- Connect agents to external services and data sources through MCP tools
