Skip to main content

What are Python Agents?

Python Agents are code-based automations that run directly in Agent Studio using the Narada Python SDK. Unlike GUI workflow agents, Python Agents give you the full flexibility of Python code for loops, conditions, data processing, API calls, and browser automation.

Full Python

Write Python code with access to the Narada SDK, Pydantic, and common libraries

AI-Generated

Created automatically by Agent Maker and Imitation Learning

SDK-Powered

Use Agent.run(), browser actions, Google Sheets helpers, and human-in-the-loop prompts

How Python Agents Are Created

There are three ways to create a Python Agent in Agent Studio:

1. Agent Maker

Describe your goal in natural language, and Agent Maker generates a complete Python Agent for you:

2. Imitation Learning

Record yourself performing a task in the browser, and Imitation Learning generates an agent from your recording.

3. Manual Creation

Create a Python Agent from scratch in Agent Studio:
1

Open Agent Studio

Navigate to Agent Studio and click + Create.
2

Select Python Agent

Choose the Python Agent option from the creation dialog.
3

Write your code

The editor opens with a starter template. Write your automation using the Narada SDK.

Writing Python Agent Code

In Agent Studio, BrowserEnvironment() targets the current browser window. Create an Agent with that environment, then call agent.run() or browser action methods on the agent:
Use new_tab=True for the first go_to_url() call in Agent Studio. This keeps the workflow runtime tab separate from the page your automation controls.

Using Structured Output

Extract typed data using Pydantic models:

Using Input Variables

Python Agents can accept input variables when invoked, making them reusable with different data:
Use variables.get("key", default) instead of variables["key"] so your agent can run standalone without input variables.
To pass values when invoking a custom Python agent, see Input Variables.

Google Sheets Integration

Read from and write to Google Sheets:

Available SDK Methods

Python Agents have access to the same agent-centered SDK methods as standalone scripts:
MethodDescription
run()Execute an AI-powered automation task
go_to_url()Navigate to a URL
agentic_selector()Interact with specific UI elements
agentic_mouse_action()Replay recorded mouse actions with agent fallback
get_url()Read the current page URL
get_screenshot()Capture a screenshot
get_full_html()Get the page’s full HTML
get_simplified_html()Get cleaned HTML
print_message()Show a message in the side panel chat
prompt_for_user_input()Collect structured user input
user_approval()Ask the user to approve or reject a step
read_google_sheet()Read data from Google Sheets
write_google_sheet()Write data to Google Sheets

Agent Kinds

Choose the agent kind when you construct an Agent:

OPERATOR

Browser automation: clicks, navigation, form filling, and data extraction from pages.

CORE_AGENT

Read-only reasoning: extracting visible data, answering questions about page content, and conversation-style tasks.

Running Python Agents

From Agent Studio

Click the Run button in the Agent Studio editor to execute your Python Agent in the current browser.

From the SDK

Invoke a custom Python Agent from the SDK using the namespaced format:

From Chat

Type the agent shortcut in the Narada chat:

Best Practices

Use new_tab=True First

Open a new tab for the first navigation so the workflow runtime stays separate

Handle Errors

Catch NaradaTimeoutError for slow pages and call agent.reset_agent_state() after timeouts

Use Structured Output

Define Pydantic models for reliable data extraction instead of parsing text responses

Print Progress

Use print_message() to show progress updates in the side panel during long workflows