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

# Versioning & Deployment

> Sandbox-first deployment with WORM audit.

Canvas workflows are semver-versioned. Publishing creates an immutable snapshot in `agent_workflow_versions` and triggers an automatic sandbox deployment.

## Deployment lifecycle

<Frame>
  <svg viewBox="0 0 720 380" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="medera/versioning.svg" style={{ width: '100%', height: 'auto', display: 'block', maxWidth: '780px', margin: '24px auto' }}><defs><pattern id="mdr-dots" x="0" y="0" width="10" height="10" patternUnits="userSpaceOnUse"><circle cx="1" cy="1" r="1" fill="rgba(0,0,0,0.08)" /></pattern></defs><rect x="0" y="0" width="720" height="380" fill="#ffffff" /><rect x="0" y="0" width="720" height="32" fill="#141413" /><circle cx="14" cy="16" r="3" fill="#ff5f57" /><circle cx="26" cy="16" r="3" fill="#febc2e" /><circle cx="38" cy="16" r="3" fill="#28c840" /><text x="54" y="20" fill="#9a9893" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="11" fontWeight="500">medera/versioning.svg</text><text x="706" y="20" textAnchor="end" fill="#9a9893" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10">sandbox-first · semver · WORM</text><rect x="0" y="32" width="720" height="348" fill="#fafaf6" /><rect x="0" y="32" width="720" height="348" fill="url(#mdr-dots)" /><rect x="0.5" y="0.5" width="719" height="379" fill="none" stroke="#141413" strokeOpacity="0.18" /><text x="360.0" y="56" textAnchor="middle" fill="#141413" fontFamily="Inter, sans-serif" fontSize="15" fontWeight="600">Sandbox-first deployment</text><rect x="167.0" y="120.0" width="80" height="40" fill="#ffffff" stroke="rgba(0,0,0,0.08)" strokeWidth="1" /><text x="207.0" y="144" textAnchor="middle" fill="#141413" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10" fontWeight="600">Edit</text><line x1="242.0" y1="140" x2="254.0" y2="140" stroke="rgba(20,20,19,0.40)" strokeWidth="1.5" /><polygon points="254.0,136 254.0,144 260.0,140" fill="rgba(20,20,19,0.25)" /><rect x="273.0" y="120.0" width="112" height="40" fill="#ffffff" stroke="rgba(0,0,0,0.08)" strokeWidth="1" /><text x="329.0" y="144" textAnchor="middle" fill="#141413" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10" fontWeight="600">Publish vX.Y.Z</text><line x1="380.0" y1="140" x2="392.0" y2="140" stroke="rgba(20,20,19,0.40)" strokeWidth="1.5" /><polygon points="392.0,136 392.0,144 398.0,140" fill="rgba(20,20,19,0.25)" /><rect x="411.0" y="120.0" width="142" height="40" fill="#76a1fc" stroke="#4f7be0" strokeWidth="1" /><text x="482.0" y="144" textAnchor="middle" fill="#ffffff" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10" fontWeight="700">Auto-deploy sandbox</text><path d="M 660 160.0 Q 672 175.0 660 190.0 L 60 190.0 Q 48 205.0 60 220.0" stroke="rgba(20,20,19,0.40)" strokeWidth="1.5" fill="none" /><rect x="223.0" y="220.0" width="112" height="40" fill="#ffffff" stroke="rgba(0,0,0,0.08)" strokeWidth="1" /><text x="279.0" y="244" textAnchor="middle" fill="#141413" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10" fontWeight="600">Verify metrics</text><line x1="330.0" y1="240" x2="342.0" y2="240" stroke="rgba(20,20,19,0.40)" strokeWidth="1.5" /><polygon points="342.0,236 342.0,244 348.0,240" fill="rgba(20,20,19,0.25)" /><rect x="361.0" y="220.0" width="136" height="40" fill="#ffffff" stroke="rgba(0,0,0,0.08)" strokeWidth="1" /><text x="429.0" y="244" textAnchor="middle" fill="#141413" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10" fontWeight="600">Promote production</text><text x="360.0" y="220" textAnchor="middle" fill="#5c5c5a" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="11">Every published version is immutable.</text><text x="360.0" y="240" textAnchor="middle" fill="#5c5c5a" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="11">Rollback = redeploy the previous version.</text><text x="360.0" y="260" textAnchor="middle" fill="#5c5c5a" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="11">Every deploy is recorded in the WORM audit log.</text><rect x="60" y="300" width="600" height="50" fill="#dbe5ff" stroke="#76a1fc" strokeWidth="1" /><text x="360.0" y="320" textAnchor="middle" fill="#4f7be0" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="11" fontWeight="700">WORM audit · semver · auto-rollback on threshold</text><text x="360.0" y="338" textAnchor="middle" fill="#4f7be0" fontFamily="ui-monospace, SFMono-Regular, Menlo, monospace" fontSize="10">Deployment alerts · time-bucketed metrics · preview tokens</text></svg>
</Frame>

## Tables

| Table                       | Migration       | Purpose                                                                     |
| :-------------------------- | :-------------- | :-------------------------------------------------------------------------- |
| `agent_workflows`           | 061 / 110 / 130 | Current draft + status + `lock_version`                                     |
| `agent_workflow_versions`   | 110             | Immutable per-version snapshot                                              |
| `agent_workflow_executions` | 110             | Per-execution trace + `trigger_type`                                        |
| `workflow_approvals`        | 111             | `user-approval` pauses                                                      |
| `workflow_schedules`        | 112 / 133       | Cron triggers                                                               |
| `agent_deployments`         | 138 / 151 / 152 | Runtime deployments — `environment`, status, snapshots, URLs, auto-rollback |
| `agent_links`               | 141             | Shareable canonical URL per deployment                                      |
| `agent_calls`               | 142             | Per-call tracking                                                           |
| `agent_call_function_logs`  | 143             | High-volume per-function-invocation log (BIGSERIAL)                         |
| `deployment_preview_access` | 144             | Token-based sandbox sharing                                                 |
| `deployment_audit_log`      | 140 / 145       | WORM-style immutable audit                                                  |
| `deployment_metrics`        | 148             | Time-bucketed metrics                                                       |
| `deployment_alerts`         | 149             | Threshold-based alerting                                                    |

## URLs

* **Sandbox** — `https://sandbox.medera.info/{org_slug}/{agent_slug}-v{version}`

* **Production** — `https://agents.medera.info/{org_slug}/{agent_slug}`

* **Sandbox auto-expiry** — `auto_expire_at` set 72 h after deploy; `expirePreviewTokens` cron runs daily at 3 AM.

## Auto-rollback

`agent_deployments.auto_rollback_config` declares thresholds (error rate, p95 latency, alert severity). When triggered, the deployment rolls back to the previous successful version and writes an `event_type='rolled_back'` row to `deployment_audit_log`.

## WORM audit

`deployment_audit_log` is append-only. UPDATE and DELETE are blocked by triggers (migration 145 fixed the FK from RESTRICT → SET NULL to preserve WORM semantics when actors are deleted).

***

## What's next

<CardGroup cols={2}>
  <Card title="Node Types" icon="https://mintcdn.com/medera-357fd587/iC-6rAuwl-0aQSw_/icons/ui/puzzle.svg?fit=max&auto=format&n=iC-6rAuwl-0aQSw_&q=85&s=eba447b2f1e34fad34c796c184970d9d" href="/agentic/canvas/node-types" width="40" height="40" data-path="icons/ui/puzzle.svg">
    16 core + 8 rail nodes.
  </Card>

  <Card title="Variables & Scopes" icon="https://mintcdn.com/medera-357fd587/iC-6rAuwl-0aQSw_/icons/ui/code.svg?fit=max&auto=format&n=iC-6rAuwl-0aQSw_&q=85&s=55229463dbd5bbb579cce6192dbc5ffc" href="/agentic/canvas/variables-scopes" width="40" height="40" data-path="icons/ui/code.svg">
    Template syntax.
  </Card>

  <Card title="Guardrails" icon="https://mintcdn.com/medera-357fd587/n1mgcc3nR2sq_PoL/icons/ui/shield-check.svg?fit=max&auto=format&n=n1mgcc3nR2sq_PoL&q=85&s=6909d120dcab3cdfef838294f042d00c" href="/agentic/canvas/guardrails" width="40" height="40" data-path="icons/ui/shield-check.svg">
    Runtime enforcement.
  </Card>

  <Card title="Transforms" icon="https://mintcdn.com/medera-357fd587/n1mgcc3nR2sq_PoL/icons/ui/wand.svg?fit=max&auto=format&n=n1mgcc3nR2sq_PoL&q=85&s=a22c0da9e3a5d39a75c28e1983f90a2b" href="/agentic/canvas/transforms-cel" width="40" height="40" data-path="icons/ui/wand.svg">
    Data shaping.
  </Card>
</CardGroup>
