I was reading through the README and trying to think about how an agent would safely choose between registered backends. workspace.runtime.exec(source, { backend }) is a nice single entry point, but the README notes that the selected backend determines whether source is a shell command or an ECMAScript module.
From the caller's perspective, it looks like you need to already know that one backend ID is shell-like and another is JS-like. If a Workspace has multiple backends registered, there doesn't seem to be a documented way to ask the runtime what backends exist, whether they're connected/lazy, or what kind of source/result they accept.
This becomes a papercut when the caller is an agent or a generic UI: it can easily pick a backend ID and pass the wrong source type, then fail only when the backend connects/executes. A small introspection API would make this much easier to use, something like:
const backends = await workspace.runtime.listBackends();
// [{ id: 'container', kind: 'shell', ready: false }, { id: 'js', kind: 'module', ready: true }]
or even just:
const info = await workspace.runtime.describeBackend('container');
if (info.source === 'shell') { ... }
That would also give a natural place to expose backend-specific limits later, such as network access, filesystem write access, or allowed imports, without changing exec itself. If this already exists somewhere, it might be worth calling it out in the README because it's key to using multiple backends safely.
I was reading through the README and trying to think about how an agent would safely choose between registered backends.
workspace.runtime.exec(source, { backend })is a nice single entry point, but the README notes that the selected backend determines whethersourceis a shell command or an ECMAScript module.From the caller's perspective, it looks like you need to already know that one backend ID is shell-like and another is JS-like. If a Workspace has multiple backends registered, there doesn't seem to be a documented way to ask the runtime what backends exist, whether they're connected/lazy, or what kind of source/result they accept.
This becomes a papercut when the caller is an agent or a generic UI: it can easily pick a backend ID and pass the wrong source type, then fail only when the backend connects/executes. A small introspection API would make this much easier to use, something like:
or even just:
That would also give a natural place to expose backend-specific limits later, such as network access, filesystem write access, or allowed imports, without changing
execitself. If this already exists somewhere, it might be worth calling it out in the README because it's key to using multiple backends safely.