Agent framework integration
Twin Browser + 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.
How Twin plugs into CrewAI
Give the crew one browser tool and every agent in it can reach the web. Twin is the right shape for this because the expensive part happens once: whichever agent triggers a cold run pays the planning, and every later agent that asks for something similar hits the compiled skill through the dispatch cache instead. The credential vault matters here too — a crew of agents does not each need their own copy of a password.
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 CrewAIdone
- Compile DOM → token-efficient indexed statedone
- Match the semantic dispatch cacherunning
- Replay compiled skill — 0 LLM callsqueued
What you get through CrewAI
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 CrewAI.
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
from crewai.tools import tool
TWIN = "https://twin-browser.com/api/v1"
@tool("Browser task")
def twin_run(url: str, prompt: str) -> str:
"""Perform a task in a real browser on an authorized URL — including
pages that require signing in. Returns the structured result."""
r = requests.post(
f"{TWIN}/run",
headers={"Authorization": f"Bearer {os.environ['TWIN_API_KEY']}"},
json={"url": url, "prompt": prompt, "success": {"kind": "extracted"}},
timeout=300,
)
return str(r.json())
# researcher = Agent(role="Researcher", tools=[twin_run], ...)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.
Install CrewAI
pip install crewai. Nothing Twin-specific is installed.
Set your key
Export TWIN_API_KEY with a key from the dashboard.
Define the tool
Decorate a function with @tool from crewai.tools; write a clear docstring — the agents read it.
Share it with the crew
Pass the tool to the agents that need the web. Skills compiled by one are available to all.
FAQ
CrewAI on Twin — common questions
Do all the agents in a crew share compiled skills?
How do credentials work when several agents need the same login?
Related
More ways to connect Twin
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.
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 CrewAI 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.