|
1 | 1 | --- |
2 | 2 | name: interchange-run-modes |
3 | | -description: Pick where an Interchange agent runs (in-process, local hub, remote hub plus sidecar) and how sidecars, credentials, and placement work. |
| 3 | +description: Pick where the Interchange control plane lives (none with runLocal, embedded hub, remote hub) and how sidecars, credentials, and placement work. |
4 | 4 | user-invocable: false |
5 | 5 | --- |
6 | 6 |
|
7 | 7 | # Interchange run modes |
8 | 8 |
|
9 | | -Pick the smallest mode that meets the need. |
| 9 | +The question is where the control plane lives. Your workflow and agent code is the same in every mode. |
10 | 10 |
|
11 | | -| Situation | Mode | |
12 | | -| ----------------------------------------------------- | -------------------------------------------------------------- | |
13 | | -| One agent inside your own CLI or app, one user | In-process `createAgent` with an isogit `contextDir` | |
14 | | -| Coding agent over a local tree | In-process plus `@intx/tools-posix` (and LSP), set `toolCwd` | |
15 | | -| Test a workflow | `runLocal` with scripted inference | |
16 | | -| Durable steps, crash resume, approvals, audit | Hub plus sidecar | |
17 | | -| Multiple users or tenants, grants, pushed credentials | Hub required | |
18 | | -| Host behind NAT, on a laptop, or firewalled | Sidecar dials out to the hub | |
19 | | -| "Desktop" personal agent | In-process, or a local hub that spawns a local sidecar process | |
20 | | -| Untrusted workload | Provisioner that declares an `isolation:*` capability | |
| 11 | +| Tier | Control plane | Use it when | |
| 12 | +| ----------------------------- | ------------------------------- | ----------------------------------------------------------------------------- | |
| 13 | +| `runLocal` / in-process agent | none | Scripts, CLI tools, CI, tests, dev loops, one user, run ends with the process | |
| 14 | +| Embedded hub | in your app process | You need hub features but want one local binary (desktop app) | |
| 15 | +| Remote hub | a hosted hub, sidecars dial out | Shared team, runs must outlive any one machine, work placed on other hosts | |
21 | 16 |
|
22 | | -There is no dedicated desktop harness in the repo. Desktop means the local-process mode. Container, VM, Workers, and browser hosts are in progress, not shipped. |
| 17 | +Embedded and remote differ only in a base URL. An app written against the hub `Transport` switches by config (`use_skill interchange-embed-hub`, `use_skill interchange-client-apps`). Moving up from `runLocal` is a deploy, not a rewrite, so start without a hub unless you need one of the reasons below. |
23 | 18 |
|
24 | | -## In-process (no hub) |
| 19 | +## Skip the hub when |
25 | 20 |
|
26 | | -See `use_skill interchange-agents`. There is no tenancy, remote credential push, or multi-user auth. You supply `authorize` and audit yourself. |
| 21 | +- Nothing to stand up: no database, keys, auth origin, or sidecar processes, and a cold start in milliseconds. |
| 22 | +- State is inspectable and disposable (a directory), with no second source of truth. |
| 23 | +- Tests and CI want hermetic runs with scripted inference and no ambient credentials. |
| 24 | +- One person starts the run and watches it end. |
| 25 | +- HITL is fine while the process lives: `run.signal(name, payload, signalId)` answers an `awaitSignal`. |
| 26 | +- You want to avoid depending on the alpha hub surface. |
| 27 | + |
| 28 | +## Want a control plane when |
| 29 | + |
| 30 | +- Waits must outlive the process (approvals, `awaitSignal`, timers): the hub parks, persists, and resumes after a crash. `runLocal` has no durability and a crashed run is terminal. |
| 31 | +- Credentials are shared and rotated: the hub seals provider keys and freezes a failover chain at deploy. |
| 32 | +- Triggers run while you are away: mail, cron, webhooks. |
| 33 | +- Several principals need grants, an audit trail, approvals routes, and spend accounting. |
| 34 | +- Work should run in a sandbox or on another host (sidecar placement). |
| 35 | +- Runs need addresses so people and agents can mail them. |
| 36 | +- A deploy must be pinned to a commit. |
| 37 | + |
| 38 | +## runLocal |
| 39 | + |
| 40 | +`runLocal(definition, { authorize, hasUpstreamSignalResolver, ... })` returns `{ runId, complete, cancel, signal }`. `authorize` and `hasUpstreamSignalResolver` are required; pass `true` for a top-level run you will signal. |
| 41 | + |
| 42 | +- Supported: signals, authorize, actions (need `actionResolver`), loops (need `loopFns`), inline child workflows, timers, an in-memory event log in `RunResult.events`, cancel, and `resumeFromEvents` if you feed the log back yourself. |
| 43 | +- Not supported: persistence, crash resume, drain, hub approval rows or `/approvals` routes, mail and triggers, tools, hub credentials, placement. |
| 44 | +- The default step invoker is a stub that returns `{ output: null }`. To run a model, pass an `invokeStep` that builds `createAgent` and calls `agent.send`. |
| 45 | +- An untimed `awaitSignal` inside a `childWorkflow` fails the child, because nothing can answer it. |
| 46 | +- Unverified: whether `onTrigger` sections run locally. |
| 47 | + |
| 48 | +For a single agent without a workflow, use in-process `createAgent` with a git-backed store and `@intx/tools-posix` (`use_skill interchange-agents`). You supply `authorize` and audit. |
| 49 | + |
| 50 | +Desktop means a local process: in-process, or an embedded hub that spawns a local sidecar process. There is no dedicated desktop harness. Container, VM, Workers, and browser hosts are in progress, not shipped. |
27 | 51 |
|
28 | 52 | ## Hub plus sidecar |
29 | 53 |
|
|
0 commit comments