A quick example to get started with AutonomousAgent
Build a working autonomous agent in just a few lines of code. The AutonomousAgent comes pre-configured with filesystem and shell tools, automatic storage, and workspace sandboxing.
Basic Example
from upsonic import AutonomousAgent, Task# Create an autonomous agent with workspaceagent = AutonomousAgent( model="anthropic/claude-sonnet-4-5", workspace="/path/to/project")# The agent can read, write, and execute in the workspacetask = Task("Read the main.py file and explain what it does")agent.print_do(task)
All file and shell operations are restricted to the workspace directory. Attempting to access files outside the workspace will be blocked for security.
What’s Included by Default
When you create an AutonomousAgent, you get:
InMemoryStorage as the default storage backend
Full session memory enabled for conversation history persistence
Filesystem toolkit for file operations (read, write, edit, search, etc.)