> ## Documentation Index
> Fetch the complete documentation index at: https://www.minitap.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Observability & Tracing

> Track task execution with local traces

Mobile-use can capture detailed local traces to help you debug and understand task execution.

> [!WARNING]
>
> Hosted Platform tracing and GIF upload have been removed. Keep traces locally and see the [migration guide](https://www.minitap.ai/docs/mobile-use-sdk/platform-migration).

## Overview

> [card] Local Traces
>
> Screenshots and action logs saved to your local filesystem

> [card] Trace Artifacts
>
> Keep screenshots, steps, and generated GIFs in storage you control

## How It Works

```mermaid theme={"theme":{"light":"github-light","dark":"vesper"}}
flowchart TD
    A[Task Execution] --> B{Tracing Enabled?}
    B -->|Yes| C[Capture Screenshots]
    B -->|No| D[No Trace Data]
    C --> E[Compile GIF]
    E --> F[Save Trace Locally]
    F --> G[Task Complete]
    D --> G
```

**How it works:**

* When `record_trace=True`, a GIF is created locally from screenshots.
* The local trace remains in storage you control.

***

## Local Trace Recording

Enable trace recording to save screenshots and action logs locally.

### Basic Usage

```python theme={"theme":{"light":"github-light","dark":"vesper"}}
task = (
    agent.new_task("Check my notifications")
    .with_trace_recording(enabled=True)
    .build()
)

result = await agent.run_task(request=task)
```

### Custom Path

```python theme={"theme":{"light":"github-light","dark":"vesper"}}
from pathlib import Path

task = (
    agent.new_task("Open settings")
    .with_trace_recording(
        enabled=True,
        path=Path("./my-traces")
    )
    .build()
)
```

### What Gets Saved

Local traces include:

* **trace.gif**: An animated GIF showing the entire execution. It’s a compilation of screenshots taken after each agent step.
* **steps.json**: A compilation of the agent’s thoughts and reasoning during the run, along with timestamps.

## Configuration Reference

### Task Request Parameters

**record\_trace** `bool` (default: true)

Controls local trace creation. Set to `False` to disable trace recording.

**trace\_path** `Path`

Local directory to save trace files. Defaults to system temporary directory.

### Example

```python theme={"theme":{"light":"github-light","dark":"vesper"}}
import asyncio
from pathlib import Path
from minitap.mobile_use.sdk import Agent

async def main():
    agent = Agent()
    agent.init()

    task = (
        agent.new_task("Check notifications")
        .with_trace_recording(enabled=True, path=Path("./local-traces"))
        .build()
    )
    result = await agent.run_task(request=task)

    print(f"Result: {result}")
    agent.clean()

asyncio.run(main())
```

### Console Output

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
[INFO] 📂✅ Traces located in: /tmp/mobile-use-traces/notification_check_success_20250121_083345
```

***

## Troubleshooting

### Trace Creation Failed

If the GIF is not created, check:

> [accordion] File Size Limit
>
> Maximum GIF size is **300MB**. Very long-running tasks (+1h) may exceed this limit.
> Reduce `max_steps` in your task configuration or split into multiple shorter tasks.

### Verify Trace Creation

Check the console output for the local trace path:

```bash theme={"theme":{"light":"github-light","dark":"vesper"}}
📂✅ Traces located in: /tmp/mobile-use-traces/{task-name}
```

If you see this message, open the directory to inspect the trace.

### Missing Local GIF

If the GIF doesn't appear in the trace directory:

1. **Check task status** - GIF generation happens after task completion
2. **Verify record\_trace=True** - Confirm tracing was not disabled
3. **Check console for errors** - Look for trace creation failures

***

## Best Practices

Tracing is enabled by default for easy debugging. Disable it when processing sensitive data or running many tasks in production:

```python theme={"theme":{"light":"github-light","dark":"vesper"}}
# Disable for sensitive data
task = (
    agent.new_task("Handle sensitive data")
    .with_trace_recording(enabled=False)
    .build()
)
result = await agent.run_task(request=task)
```

***

## Next Steps

> [card] [Task Request Builder](https://www.minitap.ai/docs/mobile-use-sdk/sdk-reference/task-request-builder.md)
>
> Explore all task configuration options

> [card] [Troubleshooting](https://www.minitap.ai/docs/mobile-use-sdk/troubleshooting.md)
>
> Common issues and solutions

> [card] [Local Quickstart](https://www.minitap.ai/docs/mobile-use-sdk/quickstart.md)
>
> Configure local task execution and tracing


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.