Skip to main content

Overview

DeepAgent extends the base Agent with advanced capabilities for handling complex, multi-step tasks. It provides automatic task planning, a virtual filesystem, subagent delegation, and configurable storage backends.

Key Features

  • Planning System: Break down complex tasks with automatic todo management
  • Virtual Filesystem: Create, read, edit files in isolated environment
  • Subagent System: Delegate tasks to specialized agents
  • Configurable Backends: Choose ephemeral or persistent storage

Quick Start

import asyncio
from upsonic.agent.deepagent import DeepAgent
from upsonic import Task

async def main():
    # Create a deep agent
    agent = DeepAgent(model="openai/gpt-4o")
    
    # 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
    result = await agent.do_async(task)
    print(result)
    
    # Check files created
    files = await agent.filesystem_backend.glob("/**/*.txt")
    print(f"Files created: {files}")

asyncio.run(main())