agent
method provides a modern, streamlined interface for executing automation tasks in the Narada Python SDK. It returns a simplified AgentResponse
object with cleaner error handling and better type safety compared to the legacy dispatch_request
method.
The
agent
method is the recommended approach for new integrations. It provides a cleaner API surface and better developer experience than the legacy dispatch_request
method.Method Signature
Parameters
The natural language instruction for the automation task. When using the
OPERATOR
agent, commands are automatically prefixed with /Operator
.The agent to use for task execution. Choose from predefined agents or provide a custom agent name.
Best for web automation tasks like clicking, navigating, and data extraction.
Whether to clear the chat history before executing the command. Useful for isolated tasks or continuing conversations.
Whether to capture an animated GIF of the automation process. GIFs are saved to your local
Narada Downloads
directory.A Pydantic model class defining the expected structure of the response. When provided, the agent will return structured data matching this schema.
The time zone for any time-related operations in the automation task.
Maximum time in seconds to wait for task completion before timing out.
Response
The method returns anAgentResponse
object with the following structure:
The execution status:
"success"
, "error"
, or "input-required"
The text response from the agent containing the results of the automation task
When
output_schema
is provided, contains the parsed structured data matching your schema. None
otherwise.Contains usage metrics:
actions
: Number of actions performedcredits
: Credits consumed for the task
Examples
Agent Types
OPERATOR Agent
Best for web automation tasks
- Clicking buttons and links
- Filling forms
- Navigating websites
- Extracting data from pages
- Downloading files
GENERALIST Agent
Best for conversational tasks
- Answering questions
- General conversation
- Text analysis
- Mathematical calculations
- Creative writing
Best Practices
Choose the Right Agent
Use
OPERATOR
for web tasks and GENERALIST
for conversation or analysis tasksStructure Your Data
Define Pydantic schemas for consistent, typed responses from complex extractions
Handle Timeouts Gracefully
Set appropriate timeouts and implement retry logic for complex or unreliable tasks
Record Complex Flows
Use
generate_gif=True
for debugging and documenting complex automation workflowsMigration from dispatch_request
If you’re migrating from the legacydispatch_request
method, here are the key differences:
The
agent
method automatically handles agent prefixes, provides better error handling, and returns a cleaner response object with proper typing support.