Getting Started
Everything you need to run Agentnetes on your codebase ยท from a first npx command to production agent swarms.
docker pull node:20-alpinenpx agentnetes run "goal"Quick Start
No installation required. Point Agentnetes at any git repo in under 2 minutes.
1. Get a Google API key
Agentnetes uses Gemini 2.5 Pro (planner) and Gemini 2.5 Flash (workers) by default. Get a free API key from aistudio.google.com. The free tier is sufficient for most tasks.
2. Pull the Docker base image
docker pull node:20-alpine
This is a one-time step. Each agent gets its own container ยท pulling it now means the first run starts immediately.
3. Run on your repo
# From inside any git repository cd your-project GOOGLE_API_KEY=your_key npx agentnetes run "add comprehensive test coverage"
What you will see
Agentnetes
Zero to a self-organizing AI agency. On demand.
Repo: https://github.com/your-org/your-repo
Goal: add comprehensive test coverage
Sandbox: cloning from git
๐ง Tech Lead
analyzing goal + repo structure
> find . -name "*.test.ts" -maxdepth 4
> grep -r "describe\|it(" src/ -l
+ ๐ Scout exploring test coverage gaps
+ ๐ Engineer implementing missing tests
+ โ
Tester verifying test suite passes
[Scout] found 12 files with no test coverage
[Engineer] writing vitest tests for auth module
+ src/auth/auth.test.ts (typescript)
[Tester] all 47 tests passing
Summary
------
Added 3 test files covering auth, middleware, and utils...
Done.npx agentnetes with no arguments to see all available commands.3. Install globally (optional)
Skip the npx prefix by installing once:
npm install -g agentnetes # Then use anywhere GOOGLE_API_KEY=your_key agentnetes run "refactor auth module to use JWT"
Prerequisites
docker pull node:20-alpineHow it Works
Agentnetes implements the RLM pattern (MIT CSAIL) ยท context lives in sandboxes, not prompts. One goal in, verified results out.
The two-tool strategy
Every agent has exactly two MCP tools ยท keeping the token footprint under ~1,000 tokens regardless of codebase size. Agents compose all other operations from these primitives:
search(pattern, path?, fileGlob?) // grep -r across the repo execute(command) // run any shell command in the sandbox
Local Dev with Docker
Run the full Agentnetes web app locally with real Docker sandboxes ยท no cloud accounts needed. Each agent gets its own node:20-alpine container with the target repo cloned inside.
1. Pre-pull the Docker image
Do this once to avoid the image download on your first run:
docker pull node:20-alpine
2. Create .env.local
In the root of the agentnetes repo, create a .env.local file:
# โโ Sandbox โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ SIMULATION_MODE=false SANDBOX_PROVIDER=docker # โโ Google Gemini ยท get free key at aistudio.google.com โโโโโโโโโโโ GOOGLE_API_KEY=your_key_here # โโ Target repo for agents to work on โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ DEMO_REPO_URL=https://github.com/expressjs/express
3. Start the dev server
npm run dev
4. Open the demo page
Navigate to http://localhost:3000/demo. The page defaults to Real mode. Use the Real/Simulation toggle in the header to switch modes. Select a model and submit a goal. Use Gemini 2.5 Flash for faster planning. 2.5 Pro has extended thinking which can take 30-60s. GOOGLE_API_KEY is read from the environment (set in .env.local or exported in your shell).
5. Watch containers spin up
In a separate terminal, poll Docker every second to see agents appearing and disappearing:
watch -n 1 docker ps
You will see one container per worker agent. They are automatically removed when the agent finishes.
DEMO_REPO_URL at a small repo like expressjs/express. Large monorepos (e.g. vercel/ai) take 60-90s to clone per container.What happens end-to-end
CLI Reference
agentnetes run
Run a swarm of agents against the current git repository.
agentnetes run "<goal>" # Examples agentnetes run "add TypeScript strict mode and fix all type errors" agentnetes run "write unit tests for the auth module" agentnetes run "implement rate limiting on all API routes" agentnetes run "add OpenTelemetry tracing throughout the app"
origin. Agentnetes auto-detects the repo URL.agentnetes snapshot create
Pre-warm a Vercel sandbox snapshot of your repo so future runs start in seconds instead of cloning from scratch.
VERCEL_TOKEN=your_token agentnetes snapshot create
agentnetes snapshot list
List all available snapshots in your Vercel account.
VERCEL_TOKEN=your_token agentnetes snapshot list
agentnetes serve
Start the Agentnetes web UI on your local machine. No source code needed.
# Start on default port 3000 npx agentnetes serve # Custom port npx agentnetes serve --port 8080
Then open http://localhost:3000 in your browser. Set GOOGLE_API_KEY in your environment before starting:
export GOOGLE_API_KEY=your_key npx agentnetes serve
Web UI (serve)
agentnetes serve starts the bundled Next.js web UI directly from the npm package. No cloning the repo or running npm run dev required.
Setting GOOGLE_API_KEY
The API key is read from environment variables only. Set it before starting the server:
# Option 1: export in your shell session export GOOGLE_API_KEY=your_key npx agentnetes serve
# Option 2: add to .env.local in the directory where you run serve GOOGLE_API_KEY=your_key
Settings modal
The Settings modal (gear icon in the header) lets you configure:
.env.local before starting the server.Real vs Simulation toggle
The header has a Real/Simulation toggle. Real is the default and runs live agents against your repo using the Gemini API. Simulation mode plays back pre-scripted scenarios and requires no API key, useful for demos and UI development.
Sandbox Providers
Each agent runs in its own isolated sandbox with the repo cloned inside. Choose the provider that fits your setup:
docker-FastDefault. node:20-alpine per agent.local-FastestRuns on host machine. No isolation.vercelVERCEL_TOKENFastest*Firecracker microVMs. Snapshot support.e2bE2B_API_KEYFastInstall e2b package separately.daytonaDAYTONA_API_KEYFastInstall @daytonaio/sdk separately.Setting the provider
# Use Docker (default for local dev) SANDBOX_PROVIDER=docker GOOGLE_API_KEY=xxx agentnetes run "goal" # Use local (fastest, no isolation) SANDBOX_PROVIDER=local GOOGLE_API_KEY=xxx agentnetes run "goal" # Use Vercel (requires VERCEL_TOKEN) SANDBOX_PROVIDER=vercel VERCEL_TOKEN=xxx GOOGLE_API_KEY=xxx agentnetes run "goal"
docker is recommended over local ยท it prevents agents from writing to your actual working directory.Configuration
All configuration is done via environment variables. No config file needed.
Full reference
# โโ LLM Provider โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ GOOGLE_API_KEY= # Required ยท get free at aistudio.google.com # โโ Sandbox โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ SANDBOX_PROVIDER=docker # docker | local | vercel | e2b | daytona VERCEL_TOKEN= # Required for vercel sandbox # โโ Models (optional overrides) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ PLANNER_MODEL=google/gemini-2.5-pro # Root Tech Lead model WORKER_MODEL=google/gemini-2.5-flash # Specialist agent model # โโ Web app / serve only โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ SIMULATION_MODE=false # true = always use simulation DEMO_REPO_URL=https://github.com/expressjs/express
Examples
Add test coverage
cd your-node-project GOOGLE_API_KEY=xxx npx agentnetes run "add vitest unit tests for all utility functions"
Fix TypeScript errors
GOOGLE_API_KEY=xxx npx agentnetes run "enable strict TypeScript and fix all type errors"
Implement a feature
GOOGLE_API_KEY=xxx npx agentnetes run "add rate limiting middleware to all Express routes using express-rate-limit"
Security audit
GOOGLE_API_KEY=xxx npx agentnetes run "audit the codebase for security vulnerabilities and fix them"
Add observability
GOOGLE_API_KEY=xxx npx agentnetes run "add OpenTelemetry tracing to all API routes and database queries"
Architecture
The core runtime is in lib/vrlm/ and is completely independent of Next.js ยท you can embed it in any Node.js application.
Embedding the runtime
import { VrlmRuntime } from 'agentnetes/runtime';
import { VrlmEventEmitter } from 'agentnetes/events';
const emitter = new VrlmEventEmitter();
emitter.on(event => {
if (event.type === 'finding') console.log(event.data.text);
if (event.type === 'artifact') console.log('File:', event.data.artifact.filename);
if (event.type === 'done') console.log('Complete.');
});
const runtime = new VrlmRuntime(emitter, {
repoUrl: 'https://github.com/your-org/your-repo',
plannerModel: 'google/gemini-2.5-pro',
workerModel: 'google/gemini-2.5-flash',
maxWorkers: 4,
maxStepsPerAgent: 20,
});
await runtime.run('add comprehensive test coverage');Event types
task-createdA new agent task was spawnedtask-updatedAgent status text changedtask-completedAgent finished successfullytask-failedAgent encountered an errorfindingAgent produced a text observationterminalAgent ran a shell command (tool call)artifactAgent created or modified a filecollaborationAgent requested input from another agentsynthesisRoot agent produced the final summarydoneAll agents finished ยท run is completeerrorFatal runtime errorTroubleshooting
Error: not inside a git repository or no remote "origin" foundGOOGLE_API_KEY is not set / no LLM provider configuredDocker daemon is not runningdocker: Cannot connect to the Docker daemonFatal: model returned empty responseAgent exceeded step budget with no resultGatewayAuthenticationError: Unauthenticated request to AI GatewayUI shows nothing after submitting a prompt (empty EventStream)Gemini 2.5 Pro hangs for 60+ seconds before planningError: web UI not foundGOOGLE_API_KEY not set: real agents will not run