← The stack
STACK GUIDE · PYTHON OR NODE

Agent workers

Workers are the part that does the job: they drive real browsers with BrowserGlass and desktop apps with DeskVNC, and report back to the web app.

Python worker

  • uv for the project, Pydantic for data, httpx for HTTP
  • The BrowserGlass Python client for browsers, the MCP Python SDK for DeskVNC and other MCP servers
  • pytest with recorded runs against the mock portals

Node worker

  • The BrowserGlass Node client, including pageMap() for agents
  • The MCP TypeScript SDK
  • Shares Zod schemas with the web app

The job pattern

  • The web app writes a job row; the worker claims it with SELECT FOR UPDATE SKIP LOCKED, so many workers can run at once
  • Every step logs what it saw and did, with a screenshot, into the audit log
  • Anything risky waits in an approval queue until a person says yes
  • Retries with backoff, and a clear failed state a person can pick up in the same browser or desktop session

Run them in psmux

  • One worker per pane, so the whole team can watch the agents work
  • psmux hooks tell you when a worker exits
LEARN HOW IT WORKS

Four ideas to understand.

You direct the agent, so you need these in your head. Ask the agent to teach them with your own code.

  1. 1Queues. Why the web app hands slow work to a worker instead of doing it in the request.
  2. 2Browser automation. How code finds a button and clicks it, and why pages break automations.
  3. 3MCP. How an AI agent discovers and calls tools such as BrowserGlass and DeskVNC.
  4. 4Retries and idempotency. Why doing a job twice must not charge or submit twice.
Explain how agent workers works in our product, in plain words, for someone who will direct the code but not type it. Use our own repo as the example. Cover: queues, browser automation, mcp, retries and idempotency. Then ask me three questions to check I understood.
ASK YOUR AGENT TO BUILD IT

A brief to start from.

Fill in the brackets with your product and paste it into your agent.

Write a [Python/Node] worker in workers/ that claims jobs from our Postgres jobs table with SELECT FOR UPDATE SKIP LOCKED, opens the mock portal with BrowserGlass, does [the job], saves a screenshot and the result, and marks the job done or failed. Risky steps wait for approval. Add retries with backoff and tests against the mock portal. Read the BrowserGlass docs in ../browserglass/docs first and show me the plan.