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.
- OPERATOR Agent
- GENERALIST Agent
- Custom Agent
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.
A file attachment to provide to the agent. Files must be uploaded first using the
upload_file()
method, which returns a File
object that can be passed here.Attachments are particularly useful with the
GENERALIST
agent for document analysis, summarization, and question answering tasks.The time zone for any time-related operations in the automation task.
A dictionary of variables for secure substitution in prompts. Variables protect sensitive data by performing substitution after the LLM generates its action plan, ensuring the LLM never sees the actual values.Use
${variable_name}
syntax in your prompt, and provide the actual values in this dictionary. This is ideal for API keys, passwords, personal information, or any data you want to keep private from the LLM.Variables are substituted at action time, after the LLM has planned its actions. The LLM will see the placeholder
${variable_name}
but never the actual value.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
- Basic Web Automation
- Structured Data Extraction
- Conversational Agent
- Error Handling & Timeouts
- Advanced Configuration
- Secure Variables
- File Attachments
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
Protect Sensitive Data
Use
variables
for API keys, passwords, or personal info to prevent the LLM from seeing actual valuesAnalyze Documents
Upload files with
upload_file()
and pass as attachment
for document analysis with the GENERALIST agentHandle 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:
- Old dispatch_request
- New agent method
The
agent
method automatically handles agent prefixes, provides better error handling, and returns a cleaner response object with proper typing support.