Skip to main content
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 constructing Agent.
AgentKind | str
default:"AgentKind.OPERATOR"
The agent to use for task execution.
Best for browser automation tasks like clicking, navigating, filling forms, and extracting data from pages.

Parameters

str
required
The natural-language instruction for the task. When using AgentKind.OPERATOR, Narada applies the correct Operator prefix automatically.
ReasoningEffort | None
default:"None"
Controls how much reasoning the Core Agent uses before responding. This option is only valid with AgentKind.CORE_AGENT.
bool | None
default:"None"
Whether to clear chat context before executing the command.
bool | None
default:"None"
Whether to capture an animated GIF of the automation trajectory.
type[BaseModel] | None
default:"None"
A Pydantic model class defining the expected structured response.
str | None
default:"None"
The prior request ID to continue a conversation.
File | IO[Any] | None
default:"None"
A file-like object to attach to the request. The SDK uploads the file automatically before dispatching the task.
str
default:"America/Los_Angeles"
The time zone for time-related operations.
list[McpServer] | None
default:"None"
MCP servers to connect during task execution.
dict[str, str] | None
default:"None"
Sensitive values substituted at action time. The LLM sees placeholders such as ${password}, not the actual values.
Mapping[str, Any] | None
default:"None"
Values passed into prompts using {{$variable_name}} syntax. File-like values are uploaded automatically.
str | None
default:"None"
URL to call when the task status changes or completes. Use this with callback_secret or callback_headers to authenticate callbacks.
InputRequiredCallback | None
default:"None"
Callback invoked when a task enters an input-required state.
CriticConfig | None
default:"None"
Optional critic configuration that validates the run after the main agent finishes.
int
default:"1000"
Maximum time in seconds to wait for task completion.

Response

Agent.run() returns an AgentResponse object:
str
Unique identifier for this request. Use it for debugging, callbacks, or conversation continuation.
str
Execution status: "success", "error", or "input-required".
str
The text response from the agent.
BaseModel | None
Parsed structured data when output_schema is provided. Otherwise None.
TextOutput | StructuredOutput
Discriminated union containing either text or structured data:
AgentUsage
Usage metrics:
  • actions: Number of actions performed
  • credits: Credits consumed for the task
ActionTrace | None
Detailed log of agent actions. Top-level action trace entries include start_ts, end_ts, and duration_ms fields. See Action Trace for the trace format and timing semantics.
dict | None
Workflow-level trace data when available.
CriticResult | None
Result from the optional critic step.

Examples

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:
Use an environment and agent instead:
For browser actions, call methods on agent:
For lifecycle and IDs, use the environment: