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.
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.
- Receive goal from AutoGendone
- Compile DOM → token-efficient indexed statedone
- Match the semantic dispatch cacherunning
- Replay compiled skill — 0 LLM callsqueued
What you get through AutoGen
Every integration is a thin wrapper over the same execution layer, so the cache, the replay, and the corpus apply no matter how you call in.
Semantic dispatch cache
A re-phrased goal fuzzy-matches an already-compiled skill, so most calls never touch the LLM.
Deterministic replay
A compiled skill replays the exact action path with zero LLM calls — fast, repeatable, cheap.
Cross-tenant skill corpus
A skill compiled once can be safely reused across tenants, so the hit rate climbs as the network runs.
One Bearer key
Auth, usage-based billing, and an audit log run on every call — the same key works from every integration.
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.
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 loopBase 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.
Install AutoGen
Install the AutoGen package for your version. Nothing Twin-specific is installed.
Write the function
A plain function that POSTs { url, prompt, success } to /api/v1/run.
Register it
Register the function with your assistant agent using AutoGen’s own tool-registration API.
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?
Does Twin handle login and MFA inside an AutoGen run?
Related
More ways to connect Twin
CrewAI
CrewAI is a Python framework for multi-agent “crews” — role-playing agents that collaborate on tasks. Tools are shared across the crew, and `@tool` from `crewai.tools` turns a function into one, using the docstring as the description the agents read.
Python
Python is where most agent code lives — LangChain, LlamaIndex, CrewAI, AutoGen, Pydantic AI and the OpenAI and Anthropic SDKs are all Python-first. Anything you can express as a function call, an agent can be given as a tool.
REST API
Twin’s REST API is the universal integration path: HTTPS endpoints under `/api/v1/*`, authenticated with a Bearer key. Any language that can make an HTTP request can drive the browser execution layer — no SDK required, and none is published.
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.