feat(cloud): implement secure agent execution engine with VM2 sandboxing #273
+2,071
−3
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.
Summary
Implements a complete cloud-native agent execution system for
apps/cloudthat safely runs external user code with proper security isolation.This PR preserves important foundational work from the
feat/cloud-agent-execution-enginebranch that was developed earlier but never merged to main.Key Components
1. AST-Based Bundle Parser (
src/lib/bundle-parser.ts)@babel/parserand@babel/traversefor AST analysiscreateAgent()andcreateLightfast()patterns2. Secure Tool Execution (
src/app/api/tool/route.ts)3. Tool Proxying System (
src/lib/tool-proxy.ts)ToolFactoryfunctions that proxy to secure execution4. Agent Execution Engine (
src/app/api/execute/route.ts)fetchRequestHandlerfor native AI SDK streaming5. Test Interface (
test-executor/page.tsx)Security Features
Documentation
This PR includes comprehensive architecture documentation:
Dependencies Added
{ "@babel/parser": "^7.28.4", "@babel/traverse": "^7.28.4", "@babel/types": "^7.28.4", "vm2": "^3.9.19", "isolated-vm": "^6.0.1", "lightfast": "workspace:^" }Testing
The system has been tested end-to-end with sample weather agent bundles that include tools with both safe and potentially unsafe operations. All security restrictions work as expected.
Future Work
This implementation provides a foundation for:
execution-service-plan.md)Related
feat/cloud-agent-execution-engine🤖 Generated with Claude Code