---
title: 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) uses `model` as a string (e.g. "anthropic/claude-3-5-sonnet-20241022") instead of `LLM` and `AgentLoop` objects.
  - `tools` is a list (can include multiple computers and decorated functions).
  - `callbacks` are now first-class for extensibility (image retention, budget, trajectory, logging, etc).
- **No explicit `loop` parameter:**
  - Loop is inferred from the `model` string (e.g. `anthropic/`, `openai/`, `omniparser+`, `ui-tars`).
- **No explicit `computer` parameter:**
  - Computers are added to `tools` list.

---

## Usage Examples: Old vs New

### 1. Anthropic Loop

**Old:**

```python
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:**

```python
async with Computer() as computer:
    agent = ComputerAgent(
        model="anthropic/claude-3-5-sonnet-20241022",
        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:**

```python
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:**

```python
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:**

```python
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:**

```python
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:**

```python
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:**

```python
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"])
```
