> ## Documentation Index
> Fetch the complete documentation index at: https://modal-computer-use.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Choose an example

> Choose a maintained Modal Computer Use example for your lifecycle, provider, or storage use case.

Start with the example that matches your use case. Each card links to a maintained example in the application repository.

<Warning>
  Some examples create billable Modal resources or call paid model APIs. Review their lifecycle and cleanup behavior before you run them.
</Warning>

<CardGroup cols={2}>
  <Card title="Use async lifecycle methods" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/async_modal_owner.py">
    Use native async creation and cleanup when your application runs an event loop. The owner example terminates its Sandbox, while the [named variant](https://github.com/ashtonchew/modal-computer-use/blob/main/examples/async_named_desktop.py) attaches without taking ownership or creates a Sandbox that it owns.
  </Card>

  <Card title="Attach to an existing desktop" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/attach_existing_sandbox.py">
    Attach to a desktop that another process owns. The example detaches on exit and leaves the Sandbox running.
  </Card>

  <Card title="Configure and prewarm a browser" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/browser_profile.py">
    Create a desktop with an explicit browser profile and prewarm setting. The example creates a billable Sandbox and disables GPU use by default.
  </Card>

  <Card title="Capture a recording" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/recording_lifecycle.py">
    Capture a desktop session through an existing local daemon. The example writes an MP4 file, so your application must define storage and retention rules.
  </Card>

  <Card title="Persist artifacts" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/volume_artifacts.py">
    Persist run artifacts in a Modal Volume v2. The example terminates its Sandbox but retains the caller-owned Volume and its data.
  </Card>

  <Card title="Run an OpenAI computer loop" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/03_openai_computer_loop.py">
    Run a bounded OpenAI computer loop with batching and screenshot reuse. Your application owns action approval, credentials, provider output retention, and model cost.
  </Card>

  <Card title="Run an Anthropic computer loop" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/anthropic_message_server.py">
    Run a bounded Anthropic computer loop with a reviewed batch tool. Your application owns policy for the hosted actions and the custom batch tool.
  </Card>

  <Card title="Review actions before execution" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/adapter_policy_hook.py">
    Add an application policy before an adapter executes an action. This credential-free example uses a fake computer and does not control a desktop.
  </Card>

  <Card title="Hand a desktop to a Modal Function" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/modal_function_session_handoff.py">
    Borrow an owned desktop for one stateful Function trajectory. Cancellation does not reverse desktop effects, so the owner must reconcile an ambiguous result.
  </Card>

  <Card title="Keep warm capacity" href="https://github.com/ashtonchew/modal-computer-use/blob/main/examples/04_warm_pool.py">
    Provision and claim bounded warm desktop capacity. Reserved Sandboxes can remain billable while idle, and each claim is one-shot.
  </Card>
</CardGroup>


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