overai-cli 3.1.6
OverAI is an AI Agents Framework with Self Reflection. OverAI application combines PraisonAI Agents, AutoGen, and CrewAI into a low-code solution for building and managing multi-agent LLM systems, focusing on simplicity, customisation, and efficient human-agent collaboration.
License: MIT
Requires Python: >=3.10

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="docs/logo/dark.png" />
    <source media="(prefers-color-scheme: light)" srcset="docs/logo/light.png" />
    <img alt="OverAI Logo" src="docs/logo/light.png" />
  </picture>
</p>

<p align="center">
<img src="https://static.pepy.tech/badge/overai" alt="Total Downloads" />
<img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License" />
</p>

<div align="center">

# OverAI Agents

</div>

OverAI Agents is a production-ready Multi-AI Agents framework with self-reflection, designed to create AI Agents to automate and solve problems ranging from simple tasks to complex challenges. By integrating OverAI Agents, AG2 (Formerly AutoGen), and CrewAI into a low-code solution, it streamlines the building and management of multi-agent LLM systems, emphasising simplicity, customisation, and effective human-agent collaboration.

---

> **Quick Paths:**
> - 🚀 **New here?** → [Quick Start](#-quick-start)
> - 📦 **Installing?** → [Installation](#-installation)
> - 💻 **Python SDK?** → [Python Examples](#-using-python-code)
> - 🎯 **CLI user?** → [CLI Reference](#-cli--no-code-interface)
> - 🔧 **Need config?** → [Configuration](#-configuration--integration)
> - 🤝 **Contributing?** → [Development](#-development)

---

## 📑 Table of Contents

### Getting Started
- [⚡ Performance](#-performance)
- [🚀 Quick Start](#-quick-start)
- [📦 Installation](#-installation)
  - [Python SDK](#python-sdk)
  - [JavaScript SDK](#javascript-sdk)
  - [Environment Variables](#environment-variables)

### Core Concepts
- [✨ Key Features](#-key-features)
- [🌐 Supported Providers](#-supported-providers)

### Python SDK
- [📘 Python Examples](#-using-python-code)
  - [1. Single Agent](#1-single-agent)
  - [2. Multi Agents](#2-multi-agents)
  - [3. Planning Mode](#3-agent-with-planning-mode)
  - [4. Deep Research](#4-deep-research-agent)
  - [5. Query Rewriter](#5-query-rewriter-agent)
  - [6. Agent Memory](#6-agent-memory-zero-dependencies)
  - [7. Rules & Instructions](#7-rules--instructions)
  - [8. Auto-Generated Memories](#8-auto-generated-memories)
  - [9. Agentic Workflows](#9-agentic-workflows)
  - [10. Hooks](#10-hooks)
  - [11. Shadow Git Checkpoints](#11-shadow-git-checkpoints)
  - [12. Background Tasks](#12-background-tasks)
  - [13. Policy Engine](#13-policy-engine)
  - [14. Thinking Budgets](#14-thinking-budgets)
  - [15. Output Styles](#15-output-styles)
  - [16. Context Compaction](#16-context-compaction)
  - [17. Field Names Reference](#17-field-names-reference-a-i-g-s)
  - [18. Extended agents.yaml](#18-extended-agentsyaml-with-workflow-patterns)
  - [19. MCP Protocol](#19-mcp-model-context-protocol)
  - [20. A2A Protocol](#20-a2a-agent2agent-protocol)
- [🛠️ Custom Tools](#️-custom-tools)

### JavaScript SDK
- [💻 JavaScript Examples](#-using-javascript-code)

### CLI Reference
- [🎯 CLI Overview](#-cli--no-code-interface)
  - [Auto Mode](#auto-mode)
  - [Interactive Mode](#interactive-mode-cli)
  - [Deep Research CLI](#deep-research-cli)
  - [Planning Mode CLI](#planning-mode-cli)
  - [Memory CLI](#memory-cli)
  - [Workflow CLI](#workflow-cli)
  - [Knowledge CLI](#knowledge-cli)
  - [Session CLI](#session-cli)
  - [Tools CLI](#tools-cli)
  - [MCP Config CLI](#mcp-config-cli)
  - [External Agents CLI](#external-agents-cli)
- [CLI Features Summary](#cli-features)

### Configuration
- [🔧 Configuration & Integration](#-configuration--integration)
  - [Ollama Integration](#ollama-integration)
  - [Groq Integration](#groq-integration)
  - [100+ Models Support](#100-models-support)
- [📋 Agents Playbook](#-agents-playbook)

### Advanced Features
- [🔬 Advanced Features](#-advanced-features)
  - [Research & Intelligence](#research--intelligence)
  - [Memory & Caching](#memory--caching)
  - [Planning & Workflows](#planning--workflows)
  - [Specialised Agents](#specialised-agents)
  - [MCP Protocol](#mcp-protocol)
  - [A2A & A2UI Protocols](#a2a--a2ui-protocols)
  - [Safety & Control](#safety--control)
  - [Developer Tools](#developer-tools)

### Architecture
- [📊 Process Types & Patterns](#-process-types--patterns)
  - [Sequential Process](#sequential-process)
  - [Hierarchical Process](#hierarchical-process)
  - [Workflow Process](#workflow-process)
  - [Agentic Patterns](#agentic-patterns)

### Data & Persistence
- [💾 Persistence (Databases)](#-persistence-databases)
- [📚 Knowledge & Retrieval (RAG)](#-knowledge--retrieval-rag)
- [🔧 Tools Table](#-tools-table)

### Learning & Community
- [⭐ Star History](#-star-history)
- [👥 Contributing](#-contributing)
- [🔧 Development](#-development)
- [❓ FAQ & Troubleshooting](#-faq--troubleshooting)

---

## ⚡ Performance

OverAI Agents is the **fastest AI agent framework** for agent instantiation.

| Framework | Avg Time (μs) | Relative |
|-----------|---------------|----------|
| **OverAI** | **3.77** | **1.00x (fastest)** |
| OpenAI Agents SDK | 5.26 | 1.39x |
| Agno | 5.64 | 1.49x |
| OverAI (LiteLLM) | 7.56 | 2.00x |
| PydanticAI | 226.94 | 60.16x |
| LangGraph | 4,558.71 | 1,209x |
| CrewAI | 15,607.92 | 4,138x |

<details>
<summary>Run benchmarks yourself</summary>

```bash
cd overai-agents
python benchmarks/simple_benchmark.py
```

</details>

---

## 🚀 Quick Start

Get started with OverAI in under 1 minute:

```bash
# Install
pip install overai

# Set API key
export OPENAI_API_KEY=your_key_here

# Create a simple agent
python -c "from overai import Agent; Agent(instructions='You are a helpful AI assistant').start('Write a haiku about AI')"
```

---

## 📦 Installation

### Python SDK

Lightweight package dedicated for coding:

```bash
pip install overai
```

For the full framework with CLI support:

```bash
pip install overai-cli
```

### JavaScript SDK

```bash
npm install overai
```

### Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `OPENAI_API_KEY` | Yes* | OpenAI API key |
| `ANTHROPIC_API_KEY` | No | Anthropic Claude API key |
| `GOOGLE_API_KEY` | No | Google Gemini API key |
| `GROQ_API_KEY` | No | Groq API key |
| `OPENAI_BASE_URL` | No | Custom API endpoint (for Ollama, Groq, etc.) |

> *At least one LLM provider API key is required.

```bash
# Set your API key
export OPENAI_API_KEY=your_key_here

# For Ollama (local models)
export OPENAI_BASE_URL=http://localhost:11434/v1

# For Groq
export OPENAI_API_KEY=your_groq_key
export OPENAI_BASE_URL=https://api.groq.com/openai/v1
```

---

## 💻 Usage

### Python Code Examples

- [📘 Complete Python Examples](#using-python-code)
- [🔧 Custom Tools](#️-custom-tools)
- [🧠 Memory Configuration](#-memory--context)

### CLI / No-Code Interface

- [🎯 Auto Mode](#auto-mode)
- [🔬 Deep Research](#deep-research-cli)
- [📋 Planning Mode](#planning-mode-cli)
- [💾 Memory Management](#memory-cli)
- [🔄 Workflow Execution](#workflow-cli)

### JavaScript Code Examples

- [💻 JavaScript Usage](#using-javascript-code)

---

## ✨ Key Features

<details open>
<summary><strong>🤖 Core Agents</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Single Agent | [Example](examples/python/agents/single-agent.py) |  |
| Multi Agents | [Example](examples/python/general/mini_agents_example.py) |  |
| Auto Agents | [Example](examples/python/general/auto_agents_example.py) |  |
| Self Reflection AI Agents | [Example](examples/python/concepts/self-reflection-details.py) |  |
| Reasoning AI Agents | [Example](examples/python/concepts/reasoning-extraction.py) |  |
| Multi Modal AI Agents | [Example](examples/python/general/multimodal.py) |  |

</details>

<details>
<summary><strong>🔄 Workflows</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Simple Workflow | [Example](examples/python/workflows/simple_workflow.py) |  |
| Workflow with Agents | [Example](examples/python/workflows/workflow_with_agents.py) |  |
| Agentic Routing (`route()`) | [Example](examples/python/workflows/workflow_routing.py) |  |
| Parallel Execution (`parallel()`) | [Example](examples/python/workflows/workflow_parallel.py) |  |
| Loop over List/CSV (`loop()`) | [Example](examples/python/workflows/workflow_loop_csv.py) |  |
| Evaluator-Optimizer (`repeat()`) | [Example](examples/python/workflows/workflow_repeat.py) |  |
| Conditional Steps | [Example](examples/python/workflows/workflow_conditional.py) |  |
| Workflow Branching | [Example](examples/python/workflows/workflow_branching.py) |  |
| Workflow Early Stop | [Example](examples/python/workflows/workflow_early_stop.py) |  |
| Workflow Checkpoints | [Example](examples/python/workflows/workflow_checkpoints.py) |  |

</details>

<details>
<summary><strong>💻 Code & Development</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Code Interpreter Agents | [Example](examples/python/agents/code-agent.py) |  |
| AI Code Editing Tools | [Example](examples/python/code/code_editing_example.py) |  |
| External Agents (All) | [Example](examples/python/code/external_agents_example.py) |  |
| Claude Code CLI | [Example](examples/python/code/claude_code_example.py) |  |
| Gemini CLI | [Example](examples/python/code/gemini_cli_example.py) |  |
| Codex CLI | [Example](examples/python/code/codex_cli_example.py) |  |
| Cursor CLI | [Example](examples/python/code/cursor_cli_example.py) |  |

</details>

<details>
<summary><strong>🧠 Memory & Knowledge</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Memory (Short & Long Term) | [Example](examples/python/general/memory_example.py) |  |
| File-Based Memory | [Example](examples/python/general/memory_example.py) |  |
| Claude Memory Tool | [Example](#claude-memory-tool-cli) |  |
| Add Custom Knowledge | [Example](examples/python/concepts/knowledge-agents.py) |  |
| RAG Agents | [Example](examples/python/concepts/rag-agents.py) |  |
| Chat with PDF Agents | [Example](examples/python/concepts/chat-with-pdf.py) |  |
| Data Readers (PDF, DOCX, etc.) | [CLI](#knowledge-cli) |  |
| Vector Store Selection | [CLI](#knowledge-cli) |  |
| Retrieval Strategies | [CLI](#knowledge-cli) |  |
| Rerankers | [CLI](#knowledge-cli) |  |
| Index Types (Vector/Keyword/Hybrid) | [CLI](#knowledge-cli) |  |
| Query Engines (Sub-Question, etc.) | [CLI](#knowledge-cli) |  |

</details>

<details>
<summary><strong>🔬 Research & Intelligence</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Deep Research Agents | [Example](examples/python/agents/research-agent.py) |  |
| Query Rewriter Agent | [Example](#5-query-rewriter-agent) |  |
| Native Web Search | [Example](examples/python/agents/websearch-agent.py) |  |
| Built-in Search Tools | [Example](examples/python/agents/websearch-agent.py) |  |
| Unified Web Search | [Example](src/overai-agents/examples/web_search_example.py) |  |
| Web Fetch (Anthropic) | [Example](#web-search-web-fetch--prompt-caching) |  |

</details>

<details>
<summary><strong>📋 Planning & Execution</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Planning Mode | [Example](examples/python/agents/planning-agent.py) |  |
| Planning Tools | [Example](#3-agent-with-planning-mode) |  |
| Planning Reasoning | [Example](#3-agent-with-planning-mode) |  |
| Prompt Chaining | [Example](examples/python/general/prompt_chaining.py) |  |
| Evaluator Optimiser | [Example](examples/python/general/evaluator-optimiser.py) |  |
| Orchestrator Workers | [Example](examples/python/general/orchestrator-workers.py) |  |

</details>

<details>
<summary><strong>👥 Specialized Agents</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Data Analyst Agent | [Example](examples/python/agents/data-analyst-agent.py) |  |
| Finance Agent | [Example](examples/python/agents/finance-agent.py) |  |
| Shopping Agent | [Example](examples/python/agents/shopping-agent.py) |  |
| Recommendation Agent | [Example](examples/python/agents/recommendation-agent.py) |  |
| Wikipedia Agent | [Example](examples/python/agents/wikipedia-agent.py) |  |
| Programming Agent | [Example](examples/python/agents/programming-agent.py) |  |
| Math Agents | [Example](examples/python/agents/math-agent.py) |  |
| Markdown Agent | [Example](examples/python/agents/markdown-agent.py) |  |
| Prompt Expander Agent | [Example](#prompt-expansion) |  |

</details>

<details>
<summary><strong>🎨 Media & Multimodal</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Image Generation Agent | [Example](examples/python/image/image-agent.py) |  |
| Image to Text Agent | [Example](examples/python/agents/image-to-text-agent.py) |  |
| Video Agent | [Example](examples/python/agents/video-agent.py) |  |
| Camera Integration | [Example](examples/python/camera/) |  |

</details>

<details>
<summary><strong>🔌 Protocols & Integration</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| MCP Transports | [Example](examples/python/mcp/mcp-transports-overview.py) |  |
| WebSocket MCP | [Example](examples/python/mcp/websocket-mcp.py) |  |
| MCP Security | [Example](examples/python/mcp/mcp-security.py) |  |
| MCP Resumability | [Example](examples/python/mcp/mcp-resumability.py) |  |
| MCP Config Management | [Example](#mcp-config-cli) |  |
| LangChain Integrated Agents | [Example](examples/python/general/langchain_example.py) |  |

</details>

<details>
<summary><strong>🛡️ Safety & Control</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Guardrails | [Example](examples/python/guardrails/comprehensive-guardrails-example.py) |  |
| Human Approval | [Example](examples/python/general/human_approval_example.py) |  |
| Rules & Instructions | [Example](#7-rules--instructions) |  |

</details>

<details>
<summary><strong>⚙️ Advanced Features</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Async & Parallel Processing | [Example](examples/python/general/async_example.py) |  |
| Parallelisation | [Example](examples/python/general/parallelisation.py) |  |
| Repetitive Agents | [Example](examples/python/concepts/repetitive-agents.py) |  |
| Agent Handoffs | [Example](examples/python/handoff/handoff_basic.py) |  |
| Stateful Agents | [Example](examples/python/stateful/workflow-state-example.py) |  |
| Autonomous Workflow | [Example](examples/python/general/autonomous-agent.py) |  |
| Structured Output Agents | [Example](examples/python/general/structured_agents_example.py) |  |
| Model Router | [Example](examples/python/agents/router-agent-cost-optimization.py) |  |
| Prompt Caching | [Example](#web-search-web-fetch--prompt-caching) |  |
| Fast Context | [Example](examples/context/00_agent_fast_context_basic.py) |  |

</details>

<details>
<summary><strong>🛠️ Tools & Configuration</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| 100+ Custom Tools | [Example](examples/python/general/tools_example.py) |  |
| YAML Configuration | [Example](examples/cookbooks/yaml/secondary_market_research_agents.yaml) |  |
| 100+ LLM Support | [Example](examples/python/providers/openai/openai_gpt4_example.py) |  |
| Callback Agents | [Example](examples/python/general/advanced-callback-systems.py) |  |
| Hooks | [Example](#10-hooks) |  |
| Middleware System | [Example](examples/middleware/basic_middleware.py) |  |
| Configurable Model | [Example](examples/middleware/configurable_model.py) |  |
| Rate Limiter | [Example](examples/middleware/rate_limiter.py) |  |
| Injected Tool State | [Example](examples/middleware/injected_state.py) |  |
| Shadow Git Checkpoints | [Example](#11-shadow-git-checkpoints) |  |
| Background Tasks | [Example](examples/background/basic_background.py) |  |
| Policy Engine | [Example](examples/policy/basic_policy.py) |  |
| Thinking Budgets | [Example](examples/thinking/basic_thinking.py) |  |
| Output Styles | [Example](examples/output/basic_output.py) |  |
| Context Compaction | [Example](examples/compaction/basic_compaction.py) |  |

</details>

<details>
<summary><strong>📊 Monitoring & Management</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Sessions Management | [Example](examples/python/sessions/comprehensive-session-management.py) |  |
| Auto-Save Sessions | [Example](#session-management-python) |  |
| History in Context | [Example](#session-management-python) |  |
| Telemetry | [Example](examples/python/telemetry/production-telemetry-example.py) |  |
| Project Docs (.praison/docs/) | [Example](#docs-cli) |  |
| AI Commit Messages | [Example](#ai-commit-cli) |  |
| @Mentions in Prompts | [Example](#mentions-in-prompts) |  |

</details>

<details>
<summary><strong>🖥️ CLI Features</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Slash Commands | [Example](examples/python/cli/slash_commands_example.py) |  |
| Autonomy Modes | [Example](examples/python/cli/autonomy_modes_example.py) |  |
| Cost Tracking | [Example](examples/python/cli/cost_tracking_example.py) |  |
| Repository Map | [Example](examples/python/cli/repo_map_example.py) |  |
| Interactive TUI | [Example](examples/python/cli/interactive_tui_example.py) |  |
| Git Integration | [Example](examples/python/cli/git_integration_example.py) |  |
| Sandbox Execution | [Example](examples/python/cli/sandbox_execution_example.py) |  |
| CLI Compare | [Example](examples/compare/cli_compare_basic.py) |  |
| Profile/Benchmark | [Example](#profile-benchmark) |  |
| Auto Mode | [Example](#auto-mode) |  |
| Init | [Example](#init) |  |
| File Input | [Example](#file-input) |  |
| Final Agent | [Example](#final-agent) |  |
| Max Tokens | [Example](#max-tokens) |  |

</details>

<details>
<summary><strong>🧪 Evaluation</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Accuracy Evaluation | [Example](examples/eval/accuracy_example.py) |  |
| Performance Evaluation | [Example](examples/eval/performance_example.py) |  |
| Reliability Evaluation | [Example](examples/eval/reliability_example.py) |  |
| Criteria Evaluation | [Example](examples/eval/criteria_example.py) |  |

</details>

<details>
<summary><strong>🎯 Agent Skills</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Skills Management | [Example](examples/skills/basic_skill_usage.py) |  |
| Custom Skills | [Example](examples/skills/custom_skill_example.py) |  |

</details>

<details>
<summary><strong>⏰ 24/7 Scheduling</strong></summary>

| Feature | Code | Docs |
|---------|:----:|:----:|
| Agent Scheduler | [Example](examples/python/scheduled_agents/news_checker_live.py) |  |

</details>

---

## 🌐 Supported Providers

OverAI supports 100+ LLM providers through seamless integration:

| Provider | Example |
|----------|:-------:|
| OpenAI | [Example](examples/python/providers/openai/openai_gpt4_example.py) |
| Anthropic | [Example](examples/python/providers/anthropic/anthropic_claude_example.py) |
| Google Gemini | [Example](examples/python/providers/google/google_gemini_example.py) |
| Ollama | [Example](examples/python/providers/ollama/ollama-agents.py) |
| Groq | [Example](examples/python/providers/groq/kimi_with_groq_example.py) |
| DeepSeek | [Example](examples/python/providers/deepseek/deepseek_example.py) |
| xAI Grok | [Example](examples/python/providers/xai/xai_grok_example.py) |
| Mistral | [Example](examples/python/providers/mistral/mistral_example.py) |
| Cohere | [Example](examples/python/providers/cohere/cohere_example.py) |
| Perplexity | [Example](examples/python/providers/perplexity/perplexity_example.py) |
| Fireworks | [Example](examples/python/providers/fireworks/fireworks_example.py) |
| Together AI | [Example](examples/python/providers/together/together_ai_example.py) |
| OpenRouter | [Example](examples/python/providers/openrouter/openrouter_example.py) |
| HuggingFace | [Example](examples/python/providers/huggingface/huggingface_example.py) |
| Azure OpenAI | [Example](examples/python/providers/azure/azure_openai_example.py) |
| AWS Bedrock | [Example](examples/python/providers/aws/aws_bedrock_example.py) |
| Google Vertex | [Example](examples/python/providers/vertex/vertex_example.py) |
| Databricks | [Example](examples/python/providers/databricks/databricks_example.py) |
| Cloudflare | [Example](examples/python/providers/cloudflare/cloudflare_example.py) |
| AI21 | [Example](examples/python/providers/ai21/ai21_example.py) |
| Replicate | [Example](examples/python/providers/replicate/replicate_example.py) |
| SageMaker | [Example](examples/python/providers/sagemaker/sagemaker_example.py) |
| Moonshot | [Example](examples/python/providers/moonshot/moonshot_example.py) |
| vLLM | [Example](examples/python/providers/vllm/vllm_example.py) |

---

## 📘 Using Python Code

Light weight package dedicated for coding:

```bash
pip install overai
export OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxx
```

### 1. Single Agent

Create app.py file and add the code below:
```python
from overai import Agent
agent = Agent(instructions="Your are a helpful AI assistant")
agent.start("Write a movie script about a robot in Mars")
```

Run:
```bash
python app.py
```

### 2. Multi Agents

Create app.py file and add the code below:
```python
from overai import Agent, OverAIAgents

research_agent = Agent(instructions="Research about AI")
summarise_agent = Agent(instructions="Summarise research agent's findings")
agents = OverAIAgents(agents=[research_agent, summarise_agent])
agents.start()
```

Run:
```bash
python app.py
```

### 3. Agent with Planning Mode

Enable planning for any agent - the agent creates a plan, then executes step by step:

```python
from overai import Agent

def search_web(query: str) -> str:
    return f"Search results for: {query}"

agent = Agent(
    name="AI Assistant",
    instructions="Research and write about topics",
    planning=True,              # Enable planning mode
    planning_tools=[search_web], # Tools for planning research
    planning_reasoning=True      # Chain-of-thought reasoning
)

result = agent.start("Research AI trends in 2025 and write a summary")
```

**What happens:**
1. 📋 Agent creates a multi-step plan
2. 🚀 Executes each step sequentially
3. 📊 Shows progress with context passing
4. ✅ Returns final result

### 4. Deep Research Agent

Automated research with real-time streaming, web search, and citations using OpenAI or Gemini Deep Research APIs.

```python
from overai import DeepResearchAgent

# OpenAI Deep Research
agent = DeepResearchAgent(
    model="o4-mini-deep-research",  # or "o3-deep-research"
    verbose=True
)

result = agent.research("What are the latest AI trends in 2025?")
print(result.report)
print(f"Citations: {len(result.citations)}")
```

```python
# Gemini Deep Research
from overai import DeepResearchAgent

agent = DeepResearchAgent(
    model="deep-research-pro",  # Auto-detected as Gemini
    verbose=True
)

result = agent.research("Research quantum computing advances")
print(result.report)
```

**Features:**
- 🔍 Multi-provider support (OpenAI, Gemini, LiteLLM)
- 📡 Real-time streaming with reasoning summaries
- 📚 Structured citations with URLs
- 🛠️ Built-in tools: web search, code interpreter, MCP, file search
- 🔄 Automatic provider detection from model name

### 5. Query Rewriter Agent

Transform user queries to improve RAG retrieval quality using multiple strategies.

```python
from overai import QueryRewriterAgent, RewriteStrategy

agent = QueryRewriterAgent(model="gpt-4o-mini")

# Basic - expands abbreviations, adds context
result = agent.rewrite("AI trends")
print(result.primary_query)  # "What are the current trends in Artificial Intelligence?"

# HyDE - generates hypothetical document for semantic matching
result = agent.rewrite("What is quantum computing?", strategy=RewriteStrategy.HYDE)

# Step-back - generates broader context question
result = agent.rewrite("GPT-4 vs Claude 3?", strategy=RewriteStrategy.STEP_BACK)

# Sub-queries - decomposes complex questions
result = agent.rewrite("RAG setup and best embedding models?", strategy=RewriteStrategy.SUB_QUERIES)

# Contextual - resolves references using chat history
result = agent.rewrite("What about cost?", chat_history=[...])
```

**Strategies:**
- **BASIC**: Expand abbreviations, fix typos, add context
- **HYDE**: Generate hypothetical document for semantic matching
- **STEP_BACK**: Generate higher-level concept questions
- **SUB_QUERIES**: Decompose multi-part questions
- **MULTI_QUERY**: Generate multiple paraphrased versions
- **CONTEXTUAL**: Resolve references using conversation history
- **AUTO**: Automatically detect best strategy

### 6. Agent Memory (Zero Dependencies)

Enable persistent memory for agents - works out of the box without any extra packages.

```python
from overai import Agent
from overai.memory import FileMemory

# Enable memory with a single parameter
agent = Agent(
    name="Personal Assistant",
    instructions="You are a helpful assistant that remembers user preferences.",
    memory=True,  # Enables file-based memory (no extra deps!)
    user_id="user123"  # Isolate memory per user
)

# Memory is automatically injected into conversations
result = agent.start("My name is John and I prefer Python")
# Agent will remember this for future conversations
```

**Memory Types:**
- **Short-term**: Rolling buffer of recent context (auto-expires)
- **Long-term**: Persistent important facts (sorted by importance)
- **Entity**: People, places, organizations with attributes
- **Episodic**: Date-based interaction history

**Advanced Features:**
```python
from overai.memory import FileMemory

memory = FileMemory(user_id="user123")

# Session Save/Resume
memory.save_session("project_session", conversation_history=[...])
memory.resume_session("project_session")

# Context Compression
memory.compress(llm_func=lambda p: agent.chat(p), max_items=10)

# Checkpointing
memory.create_checkpoint("before_refactor", include_files=["main.py"])
memory.restore_checkpoint("before_refactor", restore_files=True)

# Slash Commands
memory.handle_command("/memory show")
memory.handle_command("/memory save my_session")
```

**Storage Options:**
| Option | Dependencies | Description |
|--------|-------------|-------------|
| `memory=True` | None | File-based JSON storage (default) |
| `memory="file"` | None | Explicit file-based storage |
| `memory="sqlite"` | Built-in | SQLite with indexing |
| `memory="chromadb"` | chromadb | Vector/semantic search |

### 7. Rules & Instructions

OverAI auto-discovers instruction files from your project root and git root:

| File | Description | Priority |
|------|-------------|----------|
| `PRAISON.md` | OverAI native instructions | High |
| `PRAISON.local.md` | Local overrides (gitignored) | Higher |
| `CLAUDE.md` | Claude Code memory file | High |
| `CLAUDE.local.md` | Local overrides (gitignored) | Higher |
| `AGENTS.md` | OpenAI Codex CLI instructions | High |
| `GEMINI.md` | Gemini CLI memory file | High |
| `.cursorrules` | Cursor IDE rules | High |
| `.windsurfrules` | Windsurf IDE rules | High |
| `.claude/rules/*.md` | Claude Code modular rules | Medium |
| `.windsurf/rules/*.md` | Windsurf modular rules | Medium |
| `.cursor/rules/*.mdc` | Cursor modular rules | Medium |
| `.praison/rules/*.md` | Workspace rules | Medium |
| `~/.praison/rules/*.md` | Global rules | Low |

```python
from overai import Agent

# Agent auto-discovers CLAUDE.md, AGENTS.md, GEMINI.md, etc.
agent = Agent(name="Assistant", instructions="You are helpful.")
# Rules are injected into system prompt automatically
```

**@Import Syntax:**
```markdown
# CLAUDE.md
See @README for project overview
See @docs/architecture.md for system design
@~/.praison/my-preferences.md
```

**Rule File Format (with YAML frontmatter):**
```markdown
---
description: Python coding guidelines
globs: ["**/*.py"]
activation: always  # always, glob, manual, ai_decision
---

# Guidelines
- Use type hints
- Follow PEP 8
```

### 8. Auto-Generated Memories

```python
from overai.memory import FileMemory, AutoMemory

memory = FileMemory(user_id="user123")
auto = AutoMemory(memory, enabled=True)

# Automatically extracts and stores memories from conversations
memories = auto.process_interaction(
    "My name is John and I prefer Python for backend work"
)
# Extracts: name="John", preference="Python for backend"
```

### 9. Agentic Workflows

Create powerful multi-agent workflows with the `Workflow` class:

```python
from overai import Agent, Workflow

# Create agents
researcher = Agent(
    name="Researcher",
    role="Research Analyst",
    goal="Research topics thoroughly",
    instructions="Provide concise, factual information."
)

writer = Agent(
    name="Writer",
    role="Content Writer", 
    goal="Write engaging content",
    instructions="Write clear, engaging content based on research."
)

# Create workflow with agents as steps
workflow = Workflow(steps=[researcher, writer])

# Run workflow - agents process sequentially
result = workflow.start("What are the benefits of AI agents?")
print(result["output"])
```

**Key Features:**
- **Agent-first** - Pass `Agent` objects directly as workflow steps
- **Pattern helpers** - Use `route()`, `parallel()`, `loop()`, `repeat()`
- **Planning mode** - Enable with `planning=True`
- **Callbacks** - Monitor with `on_step_complete`, `on_workflow_complete`
- **Async execution** - Use `workflow.astart()` for async

### Workflow Patterns (route, parallel, loop, repeat)

```python
from overai import Agent, Workflow
from overai.workflows import route, parallel, loop, repeat

# 1. ROUTING - Classifier agent routes to specialized agents
classifier = Agent(name="Classifier", instructions="Respond with 'technical' or 'creative'")
tech_agent = Agent(name="TechExpert", role="Technical Expert")
creative_agent = Agent(name="Creative", role="Creative Writer")

workflow = Workflow(steps=[
    classifier,
    route({
        "technical": [tech_agent],
        "creative": [creative_agent]
    })
])

# 2. PARALLEL - Multiple agents work concurrently
market_agent = Agent(name="Market", role="Market Researcher")
competitor_agent = Agent(name="Competitor", role="Competitor Analyst")
aggregator = Agent(name="Aggregator", role="Synthesizer")

workflow = Workflow(steps=[
    parallel([market_agent, competitor_agent]),
    aggregator
])

# 3. LOOP - Agent processes each item
processor = Agent(name="Processor", role="Item Processor")
summarizer = Agent(name="Summarizer", role="Summarizer")

workflow = Workflow(
    steps=[loop(processor, over="items"), summarizer],
    variables={"items": ["AI", "ML", "NLP"]}
)

# 4. REPEAT - Evaluator-Optimizer pattern
generator = Agent(name="Generator", role="Content Generator")
evaluator = Agent(name="Evaluator", instructions="Say 'APPROVED' if good")

workflow = Workflow(steps=[
    generator,
    repeat(evaluator, until=lambda ctx: "approved" in ctx.previous_result.lower(), max_iterations=3)
])

# 5. CALLBACKS
workflow = Workflow(
    steps=[researcher, writer],
    on_step_complete=lambda name, r: print(f"✅ {name} done")
)

# 6. WITH PLANNING & REASONING
workflow = Workflow(
    steps=[researcher, writer],
    planning=True,
    reasoning=True
)

# 7. ASYNC EXECUTION
result = asyncio.run(workflow.astart("input"))

# 8. STATUS TRACKING
workflow.status  # "not_started" | "running" | "completed"
workflow.step_statuses  # {"step1": "completed", "step2": "skipped"}
```

### YAML Workflow Template

```yaml
# .praison/workflows/research.yaml
name: Research Workflow
description: Research and write content with all patterns

agents:
  researcher:
    role: Research Expert
    goal: Find accurate information
    tools: [tavily_search, web_scraper]
  writer:
    role: Content Writer
    goal: Write engaging content
  editor:
    role: Editor
    goal: Polish content

steps:
  # Sequential
  - agent: researcher
    action: Research {{topic}}
    output_variable: research_data

  # Routing
  - name: classifier
    action: Classify content type
    route:
      technical: [tech_handler]
      creative: [creative_handler]
      default: [general_handler]

  # Parallel
  - name: parallel_research
    parallel:
      - agent: researcher
        action: Research market
      - agent: researcher
        action: Research competitors

  # Loop
  - agent: writer
    action: Write about {{item}}
    loop_over: topics
    loop_var: item

  # Repeat (evaluator-optimizer)
  - agent: editor
    action: Review and improve
    repeat:
      until: "quality > 8"
      max_iterations: 3

  # Output to file
  - agent: writer
    action: Write final report
    output_file: output/{{topic}}_report.md

variables:
  topic: AI trends
  topics: [ML, NLP, Vision]

workflow:
  planning: true
  planning_llm: gpt-4o
  memory_config:
    provider: chroma
    persist: true
```

### Loading YAML Workflows

```python
from overai.workflows import YAMLWorkflowParser, WorkflowManager

# Option 1: Parse YAML string
parser = YAMLWorkflowParser()
workflow = parser.parse_string(yaml_content)
result = workflow.start("Research AI trends")

# Option 2: Load from file with WorkflowManager
manager = WorkflowManager()
workflow = manager.load_yaml("research_workflow.yaml")
result = workflow.start("Research AI trends")

# Option 3: Execute YAML directly
result = manager.execute_yaml(
    "research_workflow.yaml",
    input_data="Research AI trends",
    variables={"topic": "Machine Learning"}
)
```

### Complete workflow.yaml Reference

```yaml
# workflow.yaml - Full feature reference
name: Complete Workflow
description: Demonstrates all workflow.yaml features
framework: overai  # overai, crewai, autogen
process: workflow     # sequential, hierarchical, workflow

workflow:
  planning: true
  planning_llm: gpt-4o
  reasoning: true
  verbose: true
  memory_config:
    provider: chroma
    persist: true

variables:
  topic: AI trends
  items: [ML, NLP, Vision]

agents:
  researcher:
    name: Researcher
    role: Research Analyst
    goal: Research topics thoroughly
    instructions: "Provide detailed research findings"
    backstory: "Expert researcher with 10 years experience"  # alias for instructions
    llm: gpt-4o-mini
    function_calling_llm: gpt-4o      # For tool calls
    max_rpm: 10                        # Rate limiting
    max_execution_time: 300            # Timeout in seconds
    reflect_llm: gpt-4o               # For self-reflection
    min_reflect: 1
    max_reflect: 3
    system_template: "You are a helpful assistant"
    tools:
      - tavily_search

  writer:
    name: Writer
    role: Content Writer
    goal: Write clear content
    instructions: "Write engaging content"

steps:
  - name: research_step
    agent: researcher
    action: "Research {{topic}}"
    expected_output: "Comprehensive research report"
    output_file: "output/research.md"
    create_directory: true
    
  - name: writing_step
    agent: writer
    action: "Write article based on research"
    context:                          # Task dependencies
      - research_step
    output_json:                      # Structured output
      type: object
      properties:
        title: { type: string }
        content: { type: string }

callbacks:
  on_workflow_start: log_start
  on_step_complete: log_step
  on_workflow_complete: log_complete
```

### 10. Hooks

Intercept and modify agent behavior at various lifecycle points:

```python
from overai.hooks import (
    HookRegistry, HookRunner, HookEvent, HookResult,
    BeforeToolInput
)

# Create a hook registry
registry = HookRegistry()

# Log all tool calls
@registry.on(HookEvent.BEFORE_TOOL)
def log_tools(event_data: BeforeToolInput) -> HookResult:
    print(f"Tool: {event_data.tool_name}")
    return HookResult.allow()

# Block dangerous operations
@registry.on(HookEvent.BEFORE_TOOL)
def security_check(event_data: BeforeToolInput) -> HookResult:
    if "delete" in event_data.tool_name.lower():
        return HookResult.deny("Delete operations blocked")
    return HookResult.allow()

# Execute hooks
runner = HookRunner(registry)
```

**CLI Commands:**
```bash
overai hooks list                    # List registered hooks
overai hooks test before_tool        # Test hooks for an event
overai hooks run "echo test"         # Run a command hook
overai hooks validate hooks.json     # Validate configuration
```


### 11. Shadow Git Checkpoints

File-level undo/restore using shadow git:

```python
from overai.checkpoints import CheckpointService

service = CheckpointService(workspace_dir="./my_project")
await service.initialize()

# Save checkpoint before changes
result = await service.save("Before refactoring")

# Make changes...

# Restore if needed
await service.restore(result.checkpoint.id)

# View diff
diff = await service.diff()
```

**CLI Commands:**
```bash
overai checkpoint save "Before changes"  # Save checkpoint
overai checkpoint list                   # List checkpoints
overai checkpoint diff                   # Show changes
overai checkpoint restore abc123         # Restore to checkpoint
```

**Links:**
- [📖 Coding Docs](/features/checkpoints)
- [📖 CLI Docs](/docs/cli/checkpoint)
- [💻 Example](examples/checkpoints/basic_checkpoints.py)

---

### 12. Background Tasks

Run agent tasks asynchronously without blocking:

```python
import asyncio
from overai.background import BackgroundRunner, BackgroundConfig

async def main():
    config = BackgroundConfig(max_concurrent_tasks=3)
    runner = BackgroundRunner(config=config)
    
    async def my_task(name: str) -> str:
        await asyncio.sleep(2)
        return f"Task {name} completed"
    
    task = await runner.submit(my_task, args=("example",), name="my_task")
    await task.wait(timeout=10.0)
    print(task.result)

asyncio.run(main())
```

**CLI Commands:**
```bash
overai background list          # List running tasks
overai background status <id>   # Check task status
overai background cancel <id>   # Cancel a task
overai background clear         # Clear completed tasks
```

**Links:**
- [📖 Coding Docs](/features/background-tasks)
- [📖 CLI Docs](/docs/cli/background)
- [💻 Example](examples/background/basic_background.py)

---

### 13. Policy Engine

Control what agents can and cannot do with policy-based execution:

```python
from overai.policy import (
    PolicyEngine, Policy, PolicyRule, PolicyAction
)

engine = PolicyEngine()

policy = Policy(
    name="no_delete",
    rules=[
        PolicyRule(
            action=PolicyAction.DENY,
            resource="tool:delete_*",
            reason="Delete operations blocked"
        )
    ]
)
engine.add_policy(policy)

result = engine.check("tool:delete_file", {})
print(f"Allowed: {result.allowed}")
```

**CLI Commands:**
```bash
overai policy list                  # List policies
overai policy check "tool:name"     # Check if allowed
overai policy init                  # Create template
```

**Links:**
- [📖 Coding Docs](/features/policy-engine)
- [📖 CLI Docs](/docs/cli/policy)
- [💻 Example](examples/policy/basic_policy.py)

---

### 14. Thinking Budgets

Configure token budgets for extended thinking:

```python
from overai.thinking import ThinkingBudget, ThinkingTracker

# Use predefined levels
budget = ThinkingBudget.high()  # 16,000 tokens

# Track usage
tracker = ThinkingTracker()
session = tracker.start_session(budget_tokens=16000)
tracker.end_session(session, tokens_used=12000)

summary = tracker.get_summary()
print(f"Utilization: {summary['average_utilization']:.1%}")
```

**CLI Commands:**
```bash
overai thinking status      # Show current budget
overai thinking set high    # Set budget level
overai thinking stats       # Show usage statistics
```

**Links:**
- [📖 Coding Docs](/features/thinking-budgets)
- [📖 CLI Docs](/docs/cli/thinking)
- [💻 Example](examples/thinking/basic_thinking.py)

---

### 15. Output Styles

Configure how agents f