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

# portable • AI Agent SDK

> Move a durable run between processes.

# portable

<Badge color="blue">AI Agent</Badge>

Move a durable run between processes.

Durable execution is real and thorough -- `agent/durable.py` replays a run
from a journal -- but the journal is a local SQLite file, so a run could only
resume where it started. Pausing on a web worker, putting the state in a queue
and resuming it somewhere that shares no disk was not possible.

This exports a run's journal (its metadata and every event) as a plain dict,
and imports it into another journal:

blob = export\_run(journal, run\_id)          # -> JSON-safe dict
redis.set(key, export\_run\_json(journal, run\_id))

# elsewhere, no shared disk

run\_id = import\_run(other\_journal, blob)

# resume as usual: the replay index is rebuilt from these events

Deliberately a JOURNAL export rather than a new state format: the journal is
already the single source of truth that `DurableRunContext` replays from, so
a second representation would be a second thing to keep correct.

## Import

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.runtime import portable
```

## Classes

<CardGroup cols={2}>
  <Card title="PortableRunError" icon="brackets-curly" href="../classes/PortableRunError">
    Raised when a run cannot be exported or imported.
  </Card>
</CardGroup>

## Functions

<CardGroup cols={2}>
  <Card title="export_run()" icon="function" href="../functions/export_run">
    Everything needed to resume `run_id` in another process.
  </Card>

  <Card title="export_run_json()" icon="function" href="../functions/export_run_json">
    `export_run` as a JSON string, ready for a queue or a form field.
  </Card>

  <Card title="import_run()" icon="function" href="../functions/import_run">
    Write an exported run into `journal` and return its run id.
  </Card>

  <Card title="import_run_json()" icon="function" href="../functions/import_run_json">
    `import_run` from a JSON string.
  </Card>
</CardGroup>

### Constants

| Name                   | Value |
| ---------------------- | ----- |
| `PORTABLE_RUN_VERSION` | `1`   |
