Agent.run() executes a natural-language task in a Narada environment and returns an AgentResponse.
Create an environment first, then bind an agent to it:
Agent.run() is the current SDK interface. The older Narada().open_and_initialize_browser_window() and window.agent(...) pattern is no longer the recommended API.Constructor
Run Signature
Agent Kinds
Choose the agent kind when constructingAgent.
The agent to use for task execution.
- OPERATOR
- CORE_AGENT
- PRODUCTIVITY
- Custom Agent
Best for browser automation tasks like clicking, navigating, filling forms, and extracting data from pages.
Parameters
The natural-language instruction for the task. When using
AgentKind.OPERATOR, Narada applies the correct Operator prefix automatically.Controls how much reasoning the Core Agent uses before responding. This option is only valid with
AgentKind.CORE_AGENT.Whether to clear chat context before executing the command.
Whether to capture an animated GIF of the automation trajectory.
A Pydantic model class defining the expected structured response.
The prior request ID to continue a conversation.
A file-like object to attach to the request. The SDK uploads the file automatically before dispatching the task.
The time zone for time-related operations.
MCP servers to connect during task execution.
Sensitive values substituted at action time. The LLM sees placeholders such as
${password}, not the actual values.Values passed into prompts using
{{$variable_name}} syntax. File-like values are uploaded automatically.URL to call when the task status changes or completes. Use this with
callback_secret or callback_headers to authenticate callbacks.Callback invoked when a task enters an input-required state.
Optional critic configuration that validates the run after the main agent finishes.
Maximum time in seconds to wait for task completion.
Response
Agent.run() returns an AgentResponse object:
Unique identifier for this request. Use it for debugging, callbacks, or conversation continuation.
Execution status:
"success", "error", or "input-required".The text response from the agent.
Parsed structured data when
output_schema is provided. Otherwise None.Discriminated union containing either text or structured data:
Usage metrics:
actions: Number of actions performedcredits: Credits consumed for the task
Detailed log of agent actions. See Action Trace for the trace format.
Workflow-level trace data when available.
Result from the optional critic step.
Examples
- Basic Web Automation
- Structured Data Extraction
- Conversation
- Error Handling
- File Attachments
- Custom Agent
Best Practices
Reuse Environments
Create one environment and reuse it across multiple
Agent instances when tasks should share a browser session.Choose the Agent Kind
Use
AgentKind.OPERATOR for browser automation and AgentKind.CORE_AGENT for read-only reasoning or conversation.Use Structured Output
Define Pydantic schemas for consistent, typed responses from data extraction tasks.
Protect Sensitive Data
Use
secret_variables for passwords, API keys, or personal information that should not be exposed to the LLM.Pass Files Directly
Pass file-like objects with
attachment= instead of calling a separate upload method.Handle Timeouts
Set appropriate timeouts and call
agent.reset_agent_state() before retrying after a timeout.Migration from Older SDKs
Older SDK examples used a Narada client and window object:agent: