Workbench Node
Workbench: The Dynamic Tool Factory
In most agentic frameworks, "Tools" are static. You define them, deploy them, and the agent uses them.
In Happen, we believe agents should be able to invent their own tools.
The Workbench Node is a special system node that acts as a runtime factory. It allows an agent to write code, wrap it in a Node, and instantly use it—all within a safe, ephemeral sandbox.
The Core Concept
The Workbench is not a tool itself; it is a Meta-Tool. It listens for agent.create_tool events and emits system.tool_ready events.
It solves the two hardest problems of dynamic code execution:
Isolation: Where does the code live? (Answer: In a temporary workspace).
Safety: How do we trust the code? (Answer: Automatic Lining).
The Auto-Lining Mechanism
This is the most critical feature of the Workbench.
When the Workbench spawns a new tool, it never spawns a raw Happen Node. It spawns a Safe Node.
It automatically wraps the agent's generated code in your mandatory System Liners.
// Pseudo-code of the Workbench Factory Logic
function spawnDynamicTool(name, agentCode) {
// 1. Write code to temp file
const path = saveToTemp(name, agentCode);
// 2. Import the raw handler
const rawHandler = require(path);
// 3. FORCE-APPLY LINERS (The "Auto-Lining")
// The agent cannot escape this. It is hard-coded into the factory.
const safeHandler = line(
rawHandler,
withShadowMode, // Mandatory: Virtualizes file system
withBudget, // Mandatory: Limits execution time/cost
withTelepathy // Mandatory: Logs all activity
);
// 4. Launch Node
return createNode(name, { handler: safeHandler });
}This means an agent can invent a "File Deleter," but it cannot invent a "File Deleter that bypasses Shadow Mode." The safety is baked into the birth of the tool.
Event API
The Workbench exposes a simple event-based API for agents to use.
1. Create Tool
Event: agent.create_tool Payload:
{
"name": "csv_analyzer",
"description": "Parses CSV files and returns summary stats",
"trigger": "tool.analyze_csv",
"code": "export default (event) => { ... }"
}2. Tool Ready (Response)
Event: system.tool_ready Payload:
{
"status": "active",
"tool_name": "csv_analyzer",
"event_signature": "tool.analyze_csv",
"liners_applied": ["ShadowMode", "Budget", "Telepathy"]
}3. Destroy Tool
Event: agent.destroy_tool Payload: { "name": "csv_analyzer" }
Ephemeral Lifecycle
The Workbench enforces hygiene.
Session Scope: By default, tools created by the Workbench live only as long as the Session. When the user closes the project or clears the context, the Workbench triggers a
wipe()command.Garbage Collection: If a dynamic tool hasn't been used for 30 minutes, the Workbench automatically unloads it to free up memory.
Practical Example: The "Just-in-Time" Workflow
The Problem: The user asks, "Convert these 500 images to PNG."
The Gap: The agent realizes it has no image conversion tool.
The Invention:
Agent writes a small Node.js script using
sharporjimp.Agent emits
agent.create_toolwith this script.
The Safety Check:
Workbench receives the code.
Workbench wraps it in
withShadowMode.Workbench spins up the node
tool.image_convert.
The Execution:
Agent emits
tool.image_convert { files: [...] }.Shadow Mode Intercepts: "Tool wants to write 500 files. Allow?"
User clicks "Approve."
Tool executes.
The Cleanup: Task done. Workbench destroys
tool.image_convert.
Summary
The Workbench is the bridge between Static Capability (what you built) and Dynamic Potential (what the AI can build).
By combining the Workbench (Creation) with Liners (Control), you achieve the holy grail of agentic systems: Self-extending intelligence that cannot accidentally destroy its environment.
Last updated