TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Effectful-Tech/clanka/llms.txt
Use this file to discover all available pages before exploring further.
AgentExecutor service is responsible for running scripts in an isolated sandbox and surfacing tool capabilities to the Agent. It can operate in-process or over an RPC transport, making it suitable for both CLI tools and distributed architectures.
AgentExecutor service
AgentExecutor is an Effect Context.Service tag. The service value exposes three members — capabilities, execute, and executeUnsafe — described in detail below.
Service members
capabilities
Capabilities for this executor. The effect reads the working directory to discover AGENTS.md and resolves the available tool set.
execute()
console output as string chunks.
The JavaScript source to execute. Top-level
await is supported. The script runs inside a Node.js vm.Script sandbox with no access to require, import, process, or other Node.js globals.Callback invoked when the agent’s script calls the built-in
taskComplete function. Receives the final summary string produced by the agent.Callback invoked when the script delegates work to a sub-agent. Receives the prompt string and must return the sub-agent’s output string.
executeUnsafe()
The name of the tool to invoke. Must be a key of
AgentTools.tools.Encoded parameters matching the tool’s
parametersSchema.Encoded type. Validated against the schema before execution.Capabilities model
TypeScript declaration source (
.d.ts style) rendered from the registered tool schemas. The agent embeds this verbatim in its system prompt so the model knows what functions are available.The raw contents of
AGENTS.md in the working directory, wrapped in Option.some. Option.none when the file does not exist. The agent surfaces this to the model as persistent project-level instructions.true when a SemanticSearch service is present in context, enabling the search function inside scripts.Layers
layerLocal()
AgentExecutor that runs scripts in-process using Node.js vm. This is the standard choice for single-process deployments.
Absolute path to the working directory. Used for reading
AGENTS.md and as the CurrentDirectory context for tool handlers.Optional
Toolkit of additional tools to register alongside the built-in agent tools. Handlers for CurrentDirectory, SubagentExecutor, and TaskCompleter are provided automatically and must not be included.layerLocal automatically provides AgentToolHandlers and ToolkitRenderer. You do not need to include them manually.layerRpc
AgentExecutor that delegates all operations to a remote server over the RpcClient.Protocol transport. The client serializes execute and executeUnsafe calls and deserializes their streaming responses.
Pair this layer with
layerRpcServer on the server side. The two share the Rpcs RpcGroup definition, so protocol changes are detected at compile time.layerRpcServer()
AgentExecutor protocol over RpcServer.Protocol. Run this layer on the remote host where scripts should execute.
Working directory passed to the underlying
makeLocal constructor.Optional additional tools, same constraints as
layerLocal.Rpcs RpcGroup
Rpcs class defines the full wire protocol between layerRpc (client) and layerRpcServer (server).
| RPC | Direction | Description |
|---|---|---|
capabilities | client → server | Fetch Capabilities for the executor |
execute | client → server | Stream script output as ExecuteOutput events |
subagentOutput | client → server | Deliver sub-agent result back to an awaiting execute stream |
executeUnsafe | client → server | Invoke a single tool and return its JSON output |
ExecuteOutput tagged union
execute RPC streams values of this union over the wire.
| Variant | Fields | Description |
|---|---|---|
Text | text: string | A chunk of console output from the running script |
TaskComplete | summary: string | The script called taskComplete; carries the final summary |
Subagent | id: number, prompt: string | The script requested a sub-agent; the client must call subagentOutput with the result |