Agent framework integration

Twin Browser + AutoGen

AutoGen is Microsoft’s framework for multi-agent LLM applications — conversable agents that call registered functions and coordinate to complete a task. A function registered with an agent becomes a tool the model can invoke mid-conversation.

Agent framework4-step setupBearer key auth

How Twin plugs into AutoGen

Register one function that posts to `/api/v1/run` and the assistant can reach the web whenever the conversation needs it. There is no Twin AutoGen package — the registration is AutoGen’s own, and the function body is the same REST call every other entry here makes. The cross-tenant skill corpus means the first agent to solve a task on a given host is often not starting from nothing.

Twin is the browser execution layer your stack calls. The first run cold-compiles a skill via skill compilation; every similar request after that is matched from the cache and replayed deterministically, so your marginal cost per run trends toward zero rather than climbing with usage.

app.example.com
  1. Receive goal from AutoGendone
  2. Compile DOM → token-efficient indexed statedone
  3. Match the semantic dispatch cacherunning
  4. Replay compiled skill — 0 LLM callsqueued

Wire it up

Drop Twin into AutoGen.

Copy, paste, and swap in your Bearer key. The first run compiles a skill; repeats match the semantic dispatch cache and replay deterministically.

AutoGen — a registered browser functionpython
import os, requests

TWIN = "https://twin-browser.com/api/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['TWIN_API_KEY']}"}

def twin_run(url: str, prompt: str, success: dict) -> dict:
    """Run a browser goal on an authorized target and return the result."""
    r = requests.post(
        f"{TWIN}/run",
        headers=HEADERS,
        json={"url": url, "prompt": prompt, "success": success},
        timeout=300,
    )
    r.raise_for_status()
    return r.json()

# Register twin_run with your assistant using AutoGen's own tool API for the
# version you are on. The function above is the whole Twin side of it — there is
# no Twin AutoGen package to install.
#
# Once the assistant has solved a task, freeze it so the next run is a replay:
#   POST /api/v1/skills           { "target": "...", "goal": "..." }
#   POST /api/v1/skills/{name}/run   -> deterministic, no model in the loop

Base URL https://twin-browser.com/api/v1 · auth Authorization: Bearer ab_live_… · over MCP the same engine is run_goal, compile_skill and run_skill — the full tool table.

  1. Install AutoGen

    Install the AutoGen package for your version. Nothing Twin-specific is installed.

  2. Write the function

    A plain function that POSTs { url, prompt, success } to /api/v1/run.

  3. Register it

    Register the function with your assistant agent using AutoGen’s own tool-registration API.

  4. Start the chat

    Kick off the conversation; the assistant calls the function when it needs a browser.

FAQ

AutoGen on Twin — common questions

Is there a register_twin helper for AutoGen?
No. That helper was documented here once and never existed — no Twin Python package is published. Use AutoGen’s own function registration around the REST call shown above.
Does Twin handle login and MFA inside an AutoGen run?
Yes. Credentials live in the encrypted vault, and a sign-in run that hits a 2FA or approval wall parks by default — returning { status: "paused", sessionId } — so a human can supply the code and the run resumes rather than failing.

Wire up AutoGen in minutes.

Free to start. Usage-based credits from $29/mo — each call billed the higher of its flat action price or its metered cost.