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.
Attributes
The DeepAgent class accepts the following initialization parameters:
| Attribute | Type | Default | Description |
|---|
model | str | Model | "openai/gpt-4o" | Model identifier or Model instance |
filesystem_backend | BackendProtocol | None | StateBackend() | Backend for filesystem storage |
enable_planning | bool | True | Enable write_todos planning tool |
enable_filesystem | bool | True | Enable filesystem tools |
enable_subagents | bool | None | None | Enable task tool (auto-set based on subagents) |
subagents | List[Agent] | None | None | List of Agent instances to use as subagents |
tool_call_limit | int | 20 | Maximum tool calls per execution |
system_prompt | str | None | None | Custom system prompt |
debug | bool | False | Enable debug logging |
name | str | None | None | Agent name |
memory | Memory | None | None | Memory instance |
db | DatabaseBase | None | None | Database instance |
tools | List | None | None | Additional user tools |
Configuration Example
import asyncio
from upsonic.agent.deepagent import DeepAgent
from upsonic.agent.deepagent.backends import StateBackend, MemoryBackend, CompositeBackend
from upsonic.storage import SqliteStorage
from upsonic import Agent, Task
import tempfile
import os
async def main():
# Create specialized subagents
researcher = Agent(
model="openai/gpt-4o-mini",
name="researcher",
role="Research Specialist",
system_prompt="You are a research expert focused on gathering information"
)
writer = Agent(
model="openai/gpt-4o-mini",
name="writer",
role="Technical Writer",
system_prompt="You are a technical writing expert"
)
# Create persistent storage backend
with tempfile.NamedTemporaryFile(suffix=".db", delete=False) as tmp:
db_path = tmp.name
try:
storage = SqliteStorage(db_file=db_path)
backend = CompositeBackend(
default=StateBackend(),
routes={
"/research/": MemoryBackend(storage),
"/reports/": MemoryBackend(storage)
}
)
# Create deep agent with subagents and custom backend
agent = DeepAgent(
model="anthropic/claude-sonnet-4-5",
name="Research Agent",
subagents=[researcher, writer],
filesystem_backend=backend,
tool_call_limit=50,
debug=False
)
# Create task
task = Task(
description="Research AI frameworks and write a comprehensive comparison. Save research to /research/frameworks.txt and final report to /reports/comparison.txt"
)
# Execute
result = await agent.do_async(task)
print(result)
# Check plan
plan = agent.get_current_plan()
print(f"\nPlan: {len(plan)} tasks")
storage.close()
finally:
if os.path.exists(db_path):
os.unlink(db_path)
asyncio.run(main())