Minimal AI Code Agent with a clean TypeScript implementation.
Principles
- Think → Write code → Execute → Answer
- Results must be based on actual execution output
pnpm install
# Optional LLM config
echo "LLM_API_KEY=your_key" >> .env
echo "LLM_BASE_URL=https://api.openai.com/v1" >> .env
echo "LLM_MODEL=gpt-4o-mini" >> .env
# Dev (interactive if no args)
pnpm dev
# One‑shot prompt
pnpm dev "say hello"Notes
- Without
LLM_API_KEY, responses are stubbed with the prompt content. - One‑shot mode runs
src/cli.tssingle flow; otherwise interactive mode starts.
pnpm dev: runtsx src/cli.tswith watch modepnpm build: compile TypeScript todistpnpm build:watch: compile with watch modepnpm start: build and rundist/cli.js
pnpm lint: run ESLintpnpm lint:fix: run ESLint with auto-fixpnpm format: format code with Prettierpnpm format:check: check code formattingpnpm type-check: type checking without buildpnpm clean: remove build artifacts
pnpm example:simple: run single agent examplepnpm example:multi: run multi-agent examplepnpm example:tools: run tools test examplepnpm example:error: run error handling examplepnpm example:code: run code execution example (NEW!)
LLM_API_KEY: API key for chat completionsLLM_BASE_URL: base URL for the LLM APILLM_MODEL: model name (defaults togpt-4o-mini)
src/
├── cli.ts # CLI entry
├── core/
│ ├── light-agent.ts # Agent core
│ └── light-swarm.ts # Multi‑agent orchestration
├── shared/
│ ├── llm.ts # LLM calls
│ ├── sandbox.ts # Sandboxed code execution
│ ├── config.ts # Sandbox/exec settings
│ └── schemas.ts # Zod schemas & types
├── tools/
│ ├── tool-decorator.ts
│ ├── tool-registry.ts
│ ├── tool-dispatcher.ts
│ └── tool_executor.ts
└── ui/clean.ts # Clean UI utilities
pnpm dev "list files in cwd"pnpm dev "create hello.txt with 'Hello'"
MIT License