Move to remote execution
Change an extension so its agent sessions can run on another machine, while credentials stay in the Prompt Studio host.
Read Local and remote work first. The extension API covers the connection, workspace provider, and harness contracts. The remote execution design has the full rules for retries, cancellation, and cleanup.
For installation, connection setup, and launching remote sessions, see the Remote Workspaces extension.
Steps
- Declare a named connection with the exact HTTP methods and path prefixes it needs. Add a fixed health-check path when the service has one.
- Move credentials out of extension settings, environment variables, repository files, webviews, and child processes. People enter them in the extension’s Connections settings instead.
- Return a versioned
providerReffrom the workspace provider. It must not contain secrets. SetexecutionKindtoremote. Do not create a placeholder local path. - Make the harness read
input.workspace.executionTarget. SetcwdRequirementtooptionalonly after start, resume, reattach, follow-up, and message reads all work without a local working directory. - Implement the provider’s
resolveand the harness’sreattachbefore you rely on recovery after a restart. - Mark only safe public commands with
automation: true. Keep their input and result small and free of credentials. - Callers use machine tokens limited to one project and the exact commands they need. Each outside request needs a stable idempotency key, so a retry does not start the same work twice.
- Test local harnesses, recovery after a restart, cancellation, duplicate requests, refused scopes, and result size limits. Use a fake test credential and check that it never appears in logs, settings, or command output.
Do not replace the named connection with ctx.process, direct requests from a webview, or a general way to read secrets. Those paths move credentials outside the host.