AgentRunner class is the primary interface for executing individual tasks.
Basic Usage
Constructor
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
task_path | str | Path | Required | Path to task directory |
model | str | Gemini default | Model identifier |
provider | str | "docker" | Environment provider |
output_dir | str | Path | "output" | Where to save outputs |
watch | bool | False | Enable web viewer |
Methods
run()
Execute the task and return results.RunResult with execution details
Example:
RunResult
The result object returned byrun().
Accessing the Trajectory
Examples
Basic Task Execution
With Web Viewer
Using Daytona
Error Handling
Saving Results
Multiple Models
Best Practices
Always use async/await
Always use async/await
AgentRunner is async-only. Use
asyncio.run() for scripts:Handle errors gracefully
Handle errors gracefully
Always check
result.success and handle failures:Use meaningful output directories
Use meaningful output directories
Organize outputs by experiment or timestamp: