Code execution plugin for Ellie agents - execute TypeScript with IPC bridge to runtime tools
npm install @ellie-ai/agent-code-exec-pluginCode execution plugin for Ellie agents. Execute TypeScript code in a subprocess with IPC bridge to runtime tools.
- Execute TypeScript code using Bun
- Scripts can call runtime tools via tool()
- Scripts can report progress via progress()
- Correlation IDs for concurrent tool calls
- Configurable timeouts
``bash`
bun add @ellie-ai/agent-code-exec-plugin
`typescript
import { agentPlugin } from "@ellie-ai/agent-plugin";
import { codeExecPlugin } from "@ellie-ai/agent-code-exec-plugin";
const agent = agentPlugin({
model: anthropic({ model: "claude-sonnet-4-20250514" }),
systemMessage: You can write TypeScript code. Use tool() to call other tools.,`
toolPlugins: [
codeExecPlugin({ timeout: 60000 }),
],
});
Inside sandbox scripts, import from ./ellie:
`typescript
import { tool, progress } from "./ellie";
// Call a runtime tool
const result = await tool("google-drive-search", { query: "invoices" });
// Report progress
await progress("Processing files...");
// Concurrent calls work correctly
const [a, b] = await Promise.all([
tool("search", { q: "a" }),
tool("search", { q: "b" }),
]);
console.log(result);
`
`typescript`
codeExecPlugin({
timeout: 30000, // Execution timeout (default: 30000ms)
rpcTimeout: 60000, // RPC timeout (default: 60000ms)
})
The plugin dispatches these actions for observability:
- SANDBOX_EXEC_STARTED - Execution startedSANDBOX_EXEC_COMPLETED
- - Execution completed successfullySANDBOX_EXEC_FAILED
- - Execution failedSANDBOX_PROGRESS
- - Progress message from scriptSANDBOX_TOOL_REQUESTED
- - Tool call initiatedSANDBOX_TOOL_COMPLETED` - Tool call completed
-