The agent execution engine is the core of what makes [redacted] more than a chat app it's the runtime that turns an LLM conversation into actions on a real system.
Here's what it does
When a user sends a message like "refactor this function to use async/await," a chat app just passes that to an LLM and streams back text. An execution engine does this instead:
User prompt
→ LLM decides to use tools (Read file, Edit file, Bash, etc.)
→ Engine dispatches tool calls to real system (filesystem, shell, git)
→ Results feed back to LLM
→ LLM decides next action (or responds to user)
→ Loop continues until task is complete
That loop — plan, act, observe, repeat — is the execution engine. It's what you already have in request.js.
The core components
1. Tool Dispatcher
The heart of it. Takes a tool call from the LLM (e.g., {tool: "Edit", params: {file, old_string, new_string}}) and executes it against the real system.
Your dispatcher handles 47 tools across 11 categories:
File I/O — Read, Write, Edit, Glob, Grep
Shell — Bash, PowerShell
Search — WebSearch, WebFetch
Agents — Agent (spawn sub-agent), SendMessage, TeamCreate/Delete
Tasks — TaskCreate, TaskList, TaskGet, TaskUpdate, TaskStop, TaskOutput
Scheduling — CronCreate, CronList, CronDelete, RemoteTrigger
MCP — McpAuth, ListMcpResources, ReadMcpResource
Mode — EnterPlanMode, ExitPlanMode, EnterWorktree, ExitWorktree, EnterREPL, ExitREPL
Code intelligence — LSP (language server)
Memory — persistent memory across sessions
Skills — SkillTool for reusable behaviors
2. Agent Loop
The orchestration layer that manages the LLM conversation cycle:
while (task not complete) {
response = await llm.generate(messages, available_tools)
if (response.has_tool_calls) {
for (tool_call of response.tool_calls) {
result = await dispatcher.execute(tool_call) // ← real side effects
messages.push(result)
}
} else {
return response // done, reply to user
}
}
This is what separates an agent from a chatbot. The loop runs autonomously — the LLM keeps calling tools and acting on results until it decides it's done.
3. Safety Layer
Before a tool executes, the engine checks:
Git safety — blocks destructive ops like git push --force or git reset --hard unless explicitly authorized (git-safety.js)
Permission gating — some tools require user approval before executing
Sandboxing — shell commands run in constrained environments
Plan mode — when active, the agent can only read/search, not write — it proposes changes for user approval
4. Multi-Agent Coordination
The engine can spawn child agents that run independently:
Parent agent ("refactor the auth module")
├── Child agent 1 ("update the login flow")
├── Child agent 2 ("update the session handler")
└── Child agent 3 ("write tests for both")
Each child gets its own agent loop, tools, and context. The parent monitors progress via TaskGet/TaskOutput and coordinates results. The coordinator assigns role-based tool sets to each agent.
5. Workspace Isolation
Each agent session can operate in its own git worktree — a full copy of the repo on a separate branch. This means multiple agents can edit files concurrently without conflicts, and changes can be merged back when done.
6. Background Execution
Not all agent work is synchronous with the user:
Cron triggers — agents that run on a schedule (e.g., "check CI status every 10 minutes")
Remote triggers — agents invoked by external events (webhooks, etc.)
KAIROS — daily logs, memory consolidation, proactive prompts
Background ticks — agents that keep running after the user disconnects