feat: wire execute() flow — integrate memory, tools, broker into kernel#2
Merged
Aakashbhardwaj27 merged 1 commit intomainfrom Mar 28, 2026
Merged
feat: wire execute() flow — integrate memory, tools, broker into kernel#2Aakashbhardwaj27 merged 1 commit intomainfrom
Aakashbhardwaj27 merged 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Wire execute() flow — integrate memory, tools, broker into kernel
What does this PR do?
This is the most critical PR in Phase 1. It takes the five standalone modules (Kernel, MemoryBus, ToolRouter, MessageBroker, Scheduler) and wires them into a single, working runtime.
Before this PR: you could spawn an agent process and manage its lifecycle, but it couldn't do anything — no execution, no memory, no tool access.
After this PR:
kernel.execute()builds a fullExecutionContextand calls the agent's handler with working memory, tool invocation, message publishing, and event emission.Why?
This closes the gap between "modules exist" and "AgentVM actually runs agents." Without this, the project is scaffolding. With this, it's a runtime.
Changes
src/core/kernel.ts— Major rewriteMemoryBus,ToolRouter, andMessageBrokerinternallykernel.memory,kernel.tools,kernel.brokerkernel.execute(processId, taskInput)method:ExecutionContextwithctx.memory,ctx.useTool(),ctx.publish(),ctx.emit(),ctx.signalcrashedstate with error detailsctx.useTool()enforces agent's declared tool permissionskernel.terminate()cleans up process memory (unlesspersistent: true)kernel.registerTool(),kernel.createChannel()execution:started/completed/failed,tool:invoked/completed/registered,channel:createdtests/unit/core.test.ts— Expanded test coverageKernel.execute()suite (7 tests)Kernel + Memory Integrationsuite (3 tests — isolation, cleanup, persistence)Kernel + Tool Integrationsuite (4 tests — invocation, permissions, events)Kernel + Broker Integrationsuite (1 test — publish from handler)examples/hello-world.ts— Rewritten for real usageHow to test
Roadmap context
This completes the core of Phase 1 M1.1 and M1.2 from [ROADMAP.md](../ROADMAP.md):
What's next
agentvm init,agentvm spawn,agentvm ps,agentvm kill)