Agent sdk
Migration Guide
This guide lists breaking changes when migrating from the original ComputerAgent (v0.3.x) to the rewritten ComputerAgent (v0.4.x) and shows old vs new usage for all four agent loops.
Breaking Changes
- Initialization:
ComputerAgent(v0.4.x) usesmodelas a string (e.g. "anthropic/claude-sonnet-4-5-20250929") instead ofLLMandAgentLoopobjects.toolsis a list (can include multiple computers and decorated functions).callbacksare now first-class for extensibility (image retention, budget, trajectory, logging, etc).
- No explicit
loopparameter:- Loop is inferred from the
modelstring (e.g.anthropic/,openai/,omniparser+,ui-tars).
- Loop is inferred from the
- No explicit
computerparameter:- Computers are added to
toolslist.
- Computers are added to
Usage Examples: Old vs New
1. Anthropic Loop
Old:
async with Computer() as computer:
agent = ComputerAgent(
computer=computer,
loop=AgentLoop.ANTHROPIC,
model=LLM(provider=LLMProvider.ANTHROPIC)
)
async for result in agent.run("Take a screenshot"):
print(result)New:
async with Computer() as computer:
agent = ComputerAgent(
model="anthropic/claude-sonnet-4-5-20250929",
tools=[computer]
)
messages = [{"role": "user", "content": "Take a screenshot"}]
async for result in agent.run(messages):
for item in result["output"]:
if item["type"] == "message":
print(item["content"][0]["text"])2. OpenAI Loop
Old:
async with Computer() as computer:
agent = ComputerAgent(
computer=computer,
loop=AgentLoop.OPENAI,
model=LLM(provider=LLMProvider.OPENAI)
)
async for result in agent.run("Take a screenshot"):
print(result)New:
async with Computer() as computer:
agent = ComputerAgent(
model="openai/computer-use-preview",
tools=[computer]
)
messages = [{"role": "user", "content": "Take a screenshot"}]
async for result in agent.run(messages):
for item in result["output"]:
if item["type"] == "message":
print(item["content"][0]["text"])3. UI-TARS Loop
Old:
async with Computer() as computer:
agent = ComputerAgent(
computer=computer,
loop=AgentLoop.UITARS,
model=LLM(provider=LLMProvider.OAICOMPAT, name="ByteDance-Seed/UI-TARS-1.5-7B", provider_base_url="https://.../v1")
)
async for result in agent.run("Take a screenshot"):
print(result)New:
async with Computer() as computer:
agent = ComputerAgent(
model="huggingface-local/ByteDance-Seed/UI-TARS-1.5-7B",
tools=[computer]
)
messages = [{"role": "user", "content": "Take a screenshot"}]
async for result in agent.run(messages):
for item in result["output"]:
if item["type"] == "message":
print(item["content"][0]["text"])4. Omni Loop
Old:
async with Computer() as computer:
agent = ComputerAgent(
computer=computer,
loop=AgentLoop.OMNI,
model=LLM(provider=LLMProvider.OLLAMA, name="gemma3")
)
async for result in agent.run("Take a screenshot"):
print(result)New:
async with Computer() as computer:
agent = ComputerAgent(
model="omniparser+ollama_chat/gemma3",
tools=[computer]
)
messages = [{"role": "user", "content": "Take a screenshot"}]
async for result in agent.run(messages):
for item in result["output"]:
if item["type"] == "message":
print(item["content"][0]["text"])Was this page helpful?