Skip to main content
This quickstart covers Managed Workflows — where Nen handles the agent loop for you. If you want to bring your own agent and control the loop yourself, see the Quickstart.

Minimal Workflow

Every Nen managed workflow is a Python file with a run() function, typed Pydantic models for input and output, and a version header.
from nen import Agent
from pydantic import BaseModel, Field

__nen_version__ = "1.0.0"

class Params(BaseModel):
    customer_id: str = Field(min_length=1)

class Result(BaseModel):
    name: str

def run(params: Params) -> Result:
    agent = Agent()
    agent.execute("Open the CustomerPro application")
    agent.execute(f"Search for customer ID {params.customer_id}")
    data = agent.extract("What is the customer's full name?", Result.model_json_schema())
    return Result.model_validate(data)
The __nen_version__ = "1.0.0" header tells the runtime which SDK version your workflow targets.

What’s Happening Here

1

Define your input

Params is a Pydantic model validated from the JSON input you send via API. Invalid input returns a validation error before your code runs.
2

Define your output

Result is validated and serialized to JSON when your function returns. The caller gets structured, type-safe data.
3

Use the Agent

Agent is a VLM-powered controller. It takes a screenshot, decides what to do, and interacts with the virtual desktop.
4

Extract data

agent.extract() reads the screen and returns structured data matching your JSON schema.

Add Secrets

If your workflow needs credentials, add a SecureParams model:
from nen import Agent, Computer, Secure
from pydantic import BaseModel, Field

__nen_version__ = "1.0.0"

class Params(BaseModel):
    url: str = Field(min_length=1)

class SecureParams(BaseModel):
    password: Secure[str] = Field(min_length=8)

class Result(BaseModel):
    logged_in: bool

def run(params: Params, secure_params: SecureParams) -> Result:
    agent = Agent()
    computer = Computer()

    agent.execute(f"Open the browser to {params.url}")
    agent.execute("Click the password field")
    computer.type(secure_params.password)  # Value never enters the desktop
    computer.press("Return")

    is_logged_in = agent.verify("Is the user logged in?")
    return Result(logged_in=is_logged_in)
Secret values are never present inside the desktop. computer.type() sends a reference to the orchestrator, which types the real value on your behalf.

Trigger via API

Start your workflow with a POST request:
curl -X POST 'https://api.getnen.ai/runs' \
  -H 'x-api-key: your_api_key' \
  -H 'Content-Type: application/json' \
  -d '{
    "workflow_id": "your-workflow-id",
    "workflow_params": {
      "customer_id": "CUST-12345"
    },
    "webhook_callback": "https://your-domain.com/webhook"
  }'
Results are delivered to your webhook endpoint when the run completes.
To include secure_workflow_params you need to HMAC-sign the request — the simple x-api-key flow above returns a 403 if secure_workflow_params is present. See Secure Parameters for the signing scheme.

Next Steps

Run

Understand the workflow lifecycle and function signature

Agent

Master execute, verify, and extract

Computer

Direct keyboard, mouse, and file access

Models

Choose the right VLM for each task