Skip to main content

Attributes

AutonomousAgent inherits all attributes from Agent and adds the following autonomous-specific options:

Autonomous Agent Specific Attributes

AttributeTypeDefaultDescription
workspacestr | NoneCurrent directoryWorkspace directory path. All file/shell operations are sandboxed here
storageStorage | NoneInMemoryStorage()Custom storage backend. If None, InMemoryStorage is created automatically
enable_filesystemboolTrueEnable filesystem tools (read, write, edit, list, search, etc.)
enable_shellboolTrueEnable shell command execution tools
shell_timeoutint120Default timeout for shell commands in seconds
shell_max_outputint10000Maximum output length before truncation
blocked_commandsList[str] | NoneSecurity defaultsList of command patterns to block for security
full_session_memoryboolTrueEnable chat history persistence (enabled by default)
summary_memoryboolFalseEnable session summary generation
user_analysis_memoryboolFalseEnable user profile extraction
user_profile_schemaBaseModel | NoneNonePydantic model for user profile structure
dynamic_user_profileboolFalseGenerate profile schema dynamically
num_last_messagesint | NoneNoneLimit on message turns to keep in history
feed_tool_call_resultsbool | NoneNoneInclude tool call results in history

Inherited Agent Attributes

All standard Agent attributes are also available:
AttributeTypeDefaultDescription
modelstr | Model"openai/gpt-4o"Model identifier or Model instance
namestr | NoneNoneAgent name for identification
memoryMemory | NoneAuto-createdMemory instance (auto-created with storage if not provided)
dbDatabaseBase | NoneNoneDatabase instance (overrides memory if provided)
session_idstr | NoneAuto-generatedSession identifier for conversation tracking
user_idstr | NoneAuto-generatedUser identifier for multi-user scenarios
debugboolFalseEnable debug logging
debug_levelint1Debug level (1 = standard, 2 = detailed)
printbool | NoneNone (defaults to True)Enable printing of output. If None, reads from UPSONIC_AGENT_PRINT env var, else defaults to True
rolestr | NoneNoneAgent role
goalstr | NoneNoneAgent goal
instructionsstr | NoneNoneSpecific instructions
system_promptstr | NoneAuto-generatedCustom system prompt. If None, a built-in prompt with tool usage guidelines is generated
toolsList[Any] | NoneNoneAdditional tools (merged with default filesystem/shell tools)
tool_call_limitint100Maximum tool calls per execution
show_tool_callsboolTrueDisplay tool calls in output
context_managementboolFalseEnable context management
context_management_keep_recentint5Recent messages to keep when managing context
user_policyPolicy | List[Policy] | NoneNoneUser input safety policy
agent_policyPolicy | List[Policy] | NoneNoneAgent output safety policy
tool_policy_prePolicy | List[Policy] | NoneNoneTool safety policy for pre-execution
tool_policy_postPolicy | List[Policy] | NoneNoneTool safety policy for post-execution
retryint1Number of retry attempts
modeLiteral[“raise”, “return_false”]"raise"Retry mode behavior

Properties

PropertyTypeDescription
autonomous_workspacePathResolved workspace path
autonomous_storageStorage | NoneStorage backend created by AutonomousAgent
autonomous_memoryMemory | NoneMemory instance created by AutonomousAgent
filesystem_toolkitAutonomousFilesystemToolKit | NoneFilesystem toolkit (if enabled)
shell_toolkitAutonomousShellToolKit | NoneShell toolkit (if enabled)

Methods

MethodDescription
reset_filesystem_tracking()Clear the record of read/edited files

Configuration Example

from upsonic import AutonomousAgent, Task

# Full configuration example
agent = AutonomousAgent(
    # Model
    model="openai/gpt-4o",
    
    # Workspace (all operations sandboxed here)
    workspace="/path/to/project",
    
    # Agent identity
    name="DevAssistant",
    role="Senior Developer",
    goal="Help developers write better code",
    instructions="Follow best practices and include error handling.",
    
    # Toolkit configuration
    enable_filesystem=True,
    enable_shell=True,
    shell_timeout=60,
    
    # Memory configuration
    full_session_memory=True,
    summary_memory=True,
    
    # Debug
    debug=True
)

# Execute a task
task = Task("Create a new Python module for data validation")
result = agent.print_do(task)
print(result)