Metadata-Version: 2.4
Name: upsonic
Version: 0.76.1
Summary: Agent Framework For Fintech
Author-email: Onur ULUSOY <onur@upsonic.co>, Dogan Keskin <dogan@upsonic.co>
License-File: LICENCE
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: aiohttp>=3.13.3
Requires-Dist: anyio>=4.10.0
Requires-Dist: cloudpickle>=3.1.2
Requires-Dist: fastmcp>=2.14.5
Requires-Dist: genai-prices>=0.0.38
Requires-Dist: griffe>=1.14.0
Requires-Dist: httpx>=0.28.1
Requires-Dist: mcp[cli]>=1.26.0
Requires-Dist: nest-asyncio>=1.6.0
Requires-Dist: openai>=2.2.0
Requires-Dist: protobuf<6.0.0,>=5.27.2
Requires-Dist: psutil==6.1.1
Requires-Dist: pydantic-core>=2.27.2
Requires-Dist: pydantic>=2.10.5
Requires-Dist: python-dotenv>=1.0.1
Requires-Dist: requests>=2.32.5
Requires-Dist: rich>=13.9.4
Requires-Dist: sentry-sdk[opentelemetry]>=2.35.0
Requires-Dist: toml>=0.10.2
Requires-Dist: typing-extensions>=4.15.0
Requires-Dist: typing-inspection>=0.4.1
Requires-Dist: uv>=0.5.20
Requires-Dist: uvicorn>=0.34.0
Provides-Extra: apify-tool
Requires-Dist: apify-client>=1.8.1; extra == 'apify-tool'
Provides-Extra: chroma
Requires-Dist: chromadb>=1.0.20; (python_version < '3.14') and extra == 'chroma'
Provides-Extra: crawlee-browser
Requires-Dist: crawlee[playwright]>=1.4.0; extra == 'crawlee-browser'
Provides-Extra: csv-loader
Requires-Dist: aiofiles>=24.1.0; extra == 'csv-loader'
Provides-Extra: custom-tools
Requires-Dist: apify-client>=1.8.1; extra == 'custom-tools'
Requires-Dist: crawlee[beautifulsoup]>=1.4.0; extra == 'custom-tools'
Requires-Dist: firecrawl-py>=4.14.1; extra == 'custom-tools'
Requires-Dist: slack-sdk>=3.38.0; extra == 'custom-tools'
Provides-Extra: discord-interface
Requires-Dist: fastapi>=0.128.0; extra == 'discord-interface'
Requires-Dist: websockets>=12.0; extra == 'discord-interface'
Provides-Extra: docling-loader
Requires-Dist: docling>=2.55.1; extra == 'docling-loader'
Provides-Extra: docx-loader
Requires-Dist: python-docx>=1.2.0; extra == 'docx-loader'
Provides-Extra: embeddings
Requires-Dist: aiohttp>=3.13.3; extra == 'embeddings'
Requires-Dist: anthropic>=0.69.0; extra == 'embeddings'
Requires-Dist: azure-core>=1.35.1; extra == 'embeddings'
Requires-Dist: azure-identity>=1.25.0; extra == 'embeddings'
Requires-Dist: boto3>=1.40.45; extra == 'embeddings'
Requires-Dist: botocore>=1.40.45; extra == 'embeddings'
Requires-Dist: fastembed>=0.7.3; (python_version < '3.14') and extra == 'embeddings'
Requires-Dist: google-auth>=2.40.3; extra == 'embeddings'
Requires-Dist: google-genai>=1.41.0; extra == 'embeddings'
Requires-Dist: huggingface-hub>=0.34.4; extra == 'embeddings'
Requires-Dist: numpy>=2.2.6; extra == 'embeddings'
Requires-Dist: onnxruntime>=1.22.1; (python_version < '3.14') and extra == 'embeddings'
Requires-Dist: openai>=2.1.0; extra == 'embeddings'
Requires-Dist: requests>=2.32.5; extra == 'embeddings'
Requires-Dist: torch>=2.8.0; extra == 'embeddings'
Requires-Dist: transformers>=4.57.0; extra == 'embeddings'
Provides-Extra: faiss
Requires-Dist: faiss-cpu>=1.12.0; extra == 'faiss'
Requires-Dist: numpy>=2.2.6; extra == 'faiss'
Provides-Extra: gmail-interface
Requires-Dist: fastapi; extra == 'gmail-interface'
Requires-Dist: google-api-python-client; extra == 'gmail-interface'
Requires-Dist: google-auth-httplib2; extra == 'gmail-interface'
Requires-Dist: google-auth-oauthlib; extra == 'gmail-interface'
Provides-Extra: gmail-tool
Requires-Dist: google-api-python-client>=2.188.0; extra == 'gmail-tool'
Requires-Dist: google-auth-httplib2>=0.3.0; extra == 'gmail-tool'
Requires-Dist: google-auth-oauthlib>=1.2.4; extra == 'gmail-tool'
Provides-Extra: html-loader
Requires-Dist: aiohttp>=3.13.3; extra == 'html-loader'
Requires-Dist: beautifulsoup4>=4.14.2; extra == 'html-loader'
Requires-Dist: requests>=2.32.5; extra == 'html-loader'
Provides-Extra: json-loader
Requires-Dist: jq>=1.10.0; extra == 'json-loader'
Provides-Extra: langfuse
Requires-Dist: opentelemetry-api>=1.39.1; extra == 'langfuse'
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.39.1; extra == 'langfuse'
Requires-Dist: opentelemetry-sdk>=1.39.1; extra == 'langfuse'
Provides-Extra: loaders
Requires-Dist: aiofiles>=24.1.0; extra == 'loaders'
Requires-Dist: aiohttp>=3.13.3; extra == 'loaders'
Requires-Dist: beautifulsoup4>=4.14.2; extra == 'loaders'
Requires-Dist: docling>=2.55.1; extra == 'loaders'
Requires-Dist: jq>=1.10.0; extra == 'loaders'
Requires-Dist: lxml>=4.9.1; extra == 'loaders'
Requires-Dist: markdown-it-py>=4.0.0; extra == 'loaders'
Requires-Dist: pdfplumber>=0.11.7; extra == 'loaders'
Requires-Dist: pillow>=11.3.0; extra == 'loaders'
Requires-Dist: pymupdf>=1.26.4; extra == 'loaders'
Requires-Dist: pypdf>=6.1.1; extra == 'loaders'
Requires-Dist: python-docx>=1.2.0; extra == 'loaders'
Requires-Dist: python-frontmatter>=1.1.0; extra == 'loaders'
Requires-Dist: pyyaml>=6.0.2; extra == 'loaders'
Requires-Dist: rapidocr-onnxruntime>=1.4.4; (python_version < '3.13') and extra == 'loaders'
Requires-Dist: requests>=2.32.5; extra == 'loaders'
Provides-Extra: mail-interface
Requires-Dist: fastapi>=0.128.0; extra == 'mail-interface'
Provides-Extra: markdown-loader
Requires-Dist: markdown-it-py>=4.0.0; extra == 'markdown-loader'
Requires-Dist: python-frontmatter>=1.1.0; extra == 'markdown-loader'
Provides-Extra: mem0-storage
Requires-Dist: mem0ai>=0.1.116; extra == 'mem0-storage'
Provides-Extra: milvus
Requires-Dist: pymilvus>=2.6.1; extra == 'milvus'
Provides-Extra: models
Requires-Dist: anthropic>=0.69.0; extra == 'models'
Requires-Dist: anyio>=4.10.0; extra == 'models'
Requires-Dist: azure-core>=1.35.1; extra == 'models'
Requires-Dist: azure-identity>=1.25.0; extra == 'models'
Requires-Dist: boto3>=1.40.45; extra == 'models'
Requires-Dist: botocore>=1.40.45; extra == 'models'
Requires-Dist: cohere>=5.18.0; extra == 'models'
Requires-Dist: google-auth>=2.40.3; extra == 'models'
Requires-Dist: google-genai>=1.41.0; extra == 'models'
Requires-Dist: groq>=0.32.0; extra == 'models'
Requires-Dist: httpx>=0.28.1; extra == 'models'
Requires-Dist: mistralai>=1.9.11; extra == 'models'
Requires-Dist: mypy-boto3-bedrock-runtime>=1.40.41; extra == 'models'
Requires-Dist: openai>=2.1.0; extra == 'models'
Requires-Dist: outlines>=1.2.9; extra == 'models'
Requires-Dist: xai-sdk>=1.4.0; extra == 'models'
Provides-Extra: mongo-storage
Requires-Dist: motor>=3.7.1; extra == 'mongo-storage'
Requires-Dist: pymongo>=4.9.0; extra == 'mongo-storage'
Provides-Extra: ocr
Requires-Dist: easyocr>=1.7.2; extra == 'ocr'
Requires-Dist: paddleocr>=2.10.0; extra == 'ocr'
Requires-Dist: pillow>=11.3.0; extra == 'ocr'
Requires-Dist: pymupdf>=1.26.4; extra == 'ocr'
Requires-Dist: pytesseract>=0.3.13; extra == 'ocr'
Requires-Dist: rapidocr-onnxruntime>=1.4.4; (python_version < '3.13') and extra == 'ocr'
Provides-Extra: otel
Requires-Dist: opentelemetry-api>=1.39.1; extra == 'otel'
Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.39.1; extra == 'otel'
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.39.1; extra == 'otel'
Requires-Dist: opentelemetry-sdk>=1.39.1; extra == 'otel'
Provides-Extra: pdf-loader
Requires-Dist: pypdf>=6.1.1; extra == 'pdf-loader'
Requires-Dist: rapidocr-onnxruntime>=1.4.4; (python_version < '3.13') and extra == 'pdf-loader'
Provides-Extra: pdfplumber-loader
Requires-Dist: pdfplumber>=0.11.7; extra == 'pdfplumber-loader'
Requires-Dist: rapidocr-onnxruntime>=1.4.4; (python_version < '3.13') and extra == 'pdfplumber-loader'
Provides-Extra: pgvector
Requires-Dist: pgvector>=0.4.1; extra == 'pgvector'
Requires-Dist: psycopg>=3.2.9; extra == 'pgvector'
Requires-Dist: sqlalchemy>=2.0.44; extra == 'pgvector'
Provides-Extra: pinecone
Requires-Dist: pinecone-text>=0.11.0; (python_version < '3.14') and extra == 'pinecone'
Requires-Dist: pinecone>=7.3.0; extra == 'pinecone'
Provides-Extra: postgres-storage
Requires-Dist: asyncpg>=0.30.0; extra == 'postgres-storage'
Requires-Dist: greenlet>=3.2.3; extra == 'postgres-storage'
Requires-Dist: psycopg2-binary>=2.9.10; extra == 'postgres-storage'
Requires-Dist: psycopg[binary]>=3.2.9; extra == 'postgres-storage'
Requires-Dist: sqlalchemy>=2.0.42; extra == 'postgres-storage'
Provides-Extra: pymupdf-loader
Requires-Dist: pymupdf>=1.26.4; extra == 'pymupdf-loader'
Requires-Dist: rapidocr-onnxruntime>=1.4.4; (python_version < '3.13') and extra == 'pymupdf-loader'
Provides-Extra: qdrant
Requires-Dist: qdrant-client>=1.12.1; extra == 'qdrant'
Provides-Extra: redis-storage
Requires-Dist: redis>=5.2.1; extra == 'redis-storage'
Provides-Extra: safety-engine
Requires-Dist: detoxify>=0.5.2; extra == 'safety-engine'
Provides-Extra: slack-interface
Requires-Dist: fastapi>=0.128.0; extra == 'slack-interface'
Requires-Dist: slack-sdk>=3.39.0; extra == 'slack-interface'
Provides-Extra: sqlite-storage
Requires-Dist: aiosqlite>=0.21.0; extra == 'sqlite-storage'
Requires-Dist: greenlet>=3.2.3; extra == 'sqlite-storage'
Requires-Dist: sqlalchemy>=2.0.42; extra == 'sqlite-storage'
Provides-Extra: storage
Requires-Dist: aiosqlite>=0.21.0; extra == 'storage'
Requires-Dist: asyncpg>=0.30.0; extra == 'storage'
Requires-Dist: greenlet>=3.2.3; extra == 'storage'
Requires-Dist: mem0ai>=0.1.116; extra == 'storage'
Requires-Dist: motor>=3.7.1; extra == 'storage'
Requires-Dist: psycopg2-binary>=2.9.10; extra == 'storage'
Requires-Dist: psycopg[binary]>=3.2.9; extra == 'storage'
Requires-Dist: pymongo>=4.9.0; extra == 'storage'
Requires-Dist: redis>=5.2.1; extra == 'storage'
Requires-Dist: sqlalchemy>=2.0.42; extra == 'storage'
Provides-Extra: supermemory
Requires-Dist: supermemory>=3.25.0; extra == 'supermemory'
Provides-Extra: text-loader
Requires-Dist: aiofiles>=24.1.0; extra == 'text-loader'
Provides-Extra: tools
Requires-Dist: beautifulsoup4>=4.14.2; extra == 'tools'
Requires-Dist: ddgs>=9.10.0; extra == 'tools'
Requires-Dist: genai-prices>=0.0.29; extra == 'tools'
Requires-Dist: pandas>=2.3.2; extra == 'tools'
Requires-Dist: tavily-python>=0.7.12; extra == 'tools'
Requires-Dist: yfinance>=0.2.66; extra == 'tools'
Provides-Extra: vectordb
Requires-Dist: chromadb>=1.0.20; (python_version < '3.14') and extra == 'vectordb'
Requires-Dist: faiss-cpu>=1.12.0; extra == 'vectordb'
Requires-Dist: pgvector>=0.4.1; extra == 'vectordb'
Requires-Dist: pinecone-text>=0.11.0; (python_version < '3.14') and extra == 'vectordb'
Requires-Dist: pinecone>=7.3.0; extra == 'vectordb'
Requires-Dist: psycopg>=3.2.9; extra == 'vectordb'
Requires-Dist: pymilvus[milvus-lite]>=2.6.1; extra == 'vectordb'
Requires-Dist: qdrant-client>=1.12.1; extra == 'vectordb'
Requires-Dist: reportlab>=4.1.0; extra == 'vectordb'
Requires-Dist: scikit-learn>=1.4.0; extra == 'vectordb'
Requires-Dist: scipy>=1.13.0; extra == 'vectordb'
Requires-Dist: sqlalchemy>=2.0.44; extra == 'vectordb'
Requires-Dist: supermemory>=3.25.0; extra == 'vectordb'
Requires-Dist: weaviate-client>=4.16.9; extra == 'vectordb'
Provides-Extra: weaviate
Requires-Dist: weaviate-client>=4.16.9; extra == 'weaviate'
Provides-Extra: web
Requires-Dist: celery>=5.5.3; extra == 'web'
Requires-Dist: fastapi; extra == 'web'
Requires-Dist: python-multipart>=0.0.20; extra == 'web'
Requires-Dist: uvicorn>=0.35.0; extra == 'web'
Provides-Extra: xml-loader
Requires-Dist: lxml>=4.9.1; extra == 'xml-loader'
Provides-Extra: yaml-loader
Requires-Dist: jq>=1.10.0; extra == 'yaml-loader'
Requires-Dist: pyyaml>=6.0.2; extra == 'yaml-loader'
Description-Content-Type: text/markdown

<div align="center">

<img src="https://github.com/user-attachments/assets/fbe7219f-55bc-4748-ac4a-dd2fb2b8d9e5" width="600" />

# Upsonic

**Production-Ready AI Agent Framework with Safety First**

[![PyPI version](https://badge.fury.io/py/upsonic.svg)](https://badge.fury.io/py/upsonic)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENCE)
[![Python Version](https://img.shields.io/pypi/pyversions/upsonic.svg)](https://pypi.org/project/upsonic/)
[![GitHub stars](https://img.shields.io/github/stars/Upsonic/Upsonic.svg?style=social&label=Star)](https://github.com/Upsonic/Upsonic)
[![GitHub issues](https://img.shields.io/github/issues/Upsonic/Upsonic.svg)](https://github.com/Upsonic/Upsonic/issues)
[![Documentation](https://img.shields.io/badge/docs-upsonic.ai-brightgreen.svg)](https://docs.upsonic.ai)
[![Discord](https://img.shields.io/badge/Discord-Join%20Community-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/pmYDMSQHqY)

[Documentation](https://docs.upsonic.ai) • [Quickstart](https://docs.upsonic.ai/get-started/quickstart) • [Examples](https://docs.upsonic.ai/examples) • [Discord](https://discord.gg/pmYDMSQHqY)

</div>

---

## Overview

Upsonic is an open-source AI agent framework for building production-ready agents. It supports multiple AI providers (OpenAI, Anthropic, Azure, Bedrock) and includes built-in safety policies, OCR, memory, multi-agent coordination, and MCP tool integration.

## What Can You Build?

- **Document Analysis**: Extract and process text from images and PDFs
- **Customer Service Automation**: Agents with memory and session context
- **Financial Analysis**: Agents that analyze data, generate reports, and provide insights
- **Compliance Monitoring**: Enforce safety policies across all agent interactions
- **Research & Data Gathering**: Automate research workflows with multi-agent collaboration
- **Multi-Agent Workflows**: Orchestrate tasks across specialized agent teams

## Quick Start

### Installation

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

### Basic Agent

```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)
```

### Agent with Tools

```python
from upsonic import Agent, Task
from upsonic.tools.common_tools import YFinanceTools

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

task = Task(
    description="Give me a summary about tesla stock with tesla car models",
    tools=[YFinanceTools()]
)

agent.print_do(task)
```

### Agent with Memory

```python
from upsonic import Agent, Task
from upsonic.storage import Memory, InMemoryStorage

memory = Memory(
    storage=InMemoryStorage(),
    session_id="session_001",
    full_session_memory=True
)

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

task1 = Task(description="My name is John")
agent.print_do(task1)

task2 = Task(description="What is my name?")
agent.print_do(task2)  # Agent remembers: "Your name is John"
```

**Ready for more?** Check out the [Quickstart Guide](https://docs.upsonic.ai/get-started/quickstart) for additional examples including Knowledge Base and Team workflows.

## Key Features

- **Autonomous Agent**: An agent that can read, write, and execute code inside a sandboxed workspace, no tool setup required
- **Safety Engine**: Policy-based content filtering applied to user inputs, agent outputs, and tool interactions
- **OCR Support**: Unified interface for multiple OCR engines with PDF and image support
- **Memory Management**: Session memory and long-term storage with multiple backend options
- **Multi-Agent Teams**: Sequential and parallel agent coordination
- **Tool Integration**: MCP tools, custom tools, and human-in-the-loop workflows
- **Production Ready**: Monitoring, metrics, and enterprise deployment support

## Core Capabilities

### Autonomous Agent

`AutonomousAgent` extends `Agent` with built-in filesystem and shell tools, automatic session memory, and workspace sandboxing. Useful for coding assistants, DevOps automation, and any task that needs direct file or terminal access.

```python
from upsonic import AutonomousAgent, Task

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

task = Task("Read the main.py file and add error handling to every function")
agent.print_do(task)
```

All file and shell operations are restricted to `workspace`. Path traversal and dangerous commands are blocked.

---

### Safety Engine

The Safety Engine applies policies at three points: user inputs, agent outputs, and tool interactions. Policies can block, anonymize, replace, or raise exceptions on matched content.

```python
from upsonic import Agent, Task
from upsonic.safety_engine.policies.pii_policies import PIIAnonymizePolicy

agent = Agent(
    model="anthropic/claude-sonnet-4-5",
    user_policy=PIIAnonymizePolicy,  # anonymizes PII before sending to the LLM
)

task = Task(
    description="My email is john.doe@example.com and phone is 555-1234. What are my email and phone?"
)

# PII is anonymized before reaching the LLM, then de-anonymized in the response
result = agent.do(task)
print(result)  # "Your email is john.doe@example.com and phone is 555-1234"
```

Pre-built policies cover PII, adult content, profanity, financial data, and more. Custom policies are also supported.

Learn more: [Safety Engine Documentation](https://docs.upsonic.ai/concepts/safety-engine/overview)

---

### OCR and Document Processing

Upsonic provides a unified OCR interface with a layered pipeline: Layer 0 handles document preparation (PDF to image conversion, preprocessing), Layer 1 runs the OCR engine.

```bash
uv pip install "upsonic[ocr]"
```

```python
from upsonic.ocr import OCR
from upsonic.ocr.layer_1.engines import EasyOCREngine

engine = EasyOCREngine(languages=["en"])
ocr = OCR(layer_1_ocr_engine=engine)

text = ocr.get_text("invoice.pdf")
print(text)
```

Supported engines: EasyOCR, RapidOCR, Tesseract, PaddleOCR, DeepSeek OCR, DeepSeek via Ollama.

Learn more: [OCR Documentation](https://docs.upsonic.ai/concepts/ocr/overview)

## Upsonic AgentOS

AgentOS is an optional deployment platform for running agents in production. It provides a Kubernetes-based runtime, metrics dashboard, and self-hosted deployment.

- **Kubernetes-based FastAPI Runtime**: Deploy agents as isolated, scalable microservices
- **Metrics Dashboard**: Track LLM costs, token usage, and performance per transaction
- **Self-Hosted**: Full control over your data and infrastructure
- **One-Click Deployment**: Automated deployment pipelines

<img width="3024" height="1590" alt="AgentOS Dashboard" src="https://github.com/user-attachments/assets/42fceaca-2dec-4496-ab67-4b9067caca42" />

## IDE Integration

Add Upsonic docs as a source in your coding tools:

**Cursor:** Settings → Indexing & Docs → Add `https://docs.upsonic.ai/llms-full.txt`

Also works with VSCode, Windsurf, and similar tools.

## Documentation and Resources

- **[Documentation](https://docs.upsonic.ai)** - Complete guides and API reference
- **[Quickstart Guide](https://docs.upsonic.ai/get-started/quickstart)** - Get started in 5 minutes
- **[Examples](https://docs.upsonic.ai/examples)** - Real-world examples and use cases
- **[API Reference](https://docs.upsonic.ai/reference)** - Detailed API documentation

## Community and Support

> **💬 [Join our Discord community!](https://discord.gg/pmYDMSQHqY)** — Ask questions, share what you're building, get help from the team, and connect with other developers using Upsonic.

- **[Discord](https://discord.gg/pmYDMSQHqY)** - Chat with the community and get real-time support
- **[Issue Tracker](https://github.com/Upsonic/Upsonic/issues)** - Report bugs and request features
- **[Changelog](https://docs.upsonic.ai/changelog)** - See what's new in each release

## License

Upsonic is released under the MIT License. See [LICENCE](LICENCE) for details.

## Contributing

We welcome contributions from the community! Please read our contributing guidelines and code of conduct before submitting pull requests.

---

**Learn more at [upsonic.ai](https://upsonic.ai)**
