AI Agent Pipeline | Part of App Factory
Describe an AI agent idea. Get a complete, production-ready scaffold.
- Developers building AI-powered agents/bots
- Builders creating automated workflows
- Anyone who wants an HTTP-based AI service
Not for you if: You need a mobile app (use app-factory) or a web app (use dapp-factory)
cd agent-factory
claudeYou: "Build an agent that summarizes YouTube videos"
Claude:
- Normalizes your intent into a product specification
- Writes comprehensive agent spec with all requirements
- Researches competitors and positioning
- Asks 4 questions (name, description, env vars, token integration)
- Generates complete agent in
outputs/youtube-summarizer/ - Runs Ralph Polish Loop until quality passes
When done:
cd outputs/youtube-summarizer
npm install
npm run dev
curl http://localhost:8080/healthBefore building your own agent, try the reference implementation:
cd examples/codebase-explainer
npm install
cp .env.example .env
# Add your OPENAI_API_KEY to .env
npm run devTest it:
curl http://localhost:8080/health
curl -X POST http://localhost:8080/explain \
-H "Content-Type: application/json" \
-d '{"question": "What does this project do?", "directory": "/path/to/any/codebase"}'See examples/codebase-explainer/RUNBOOK.md for full documentation.
"Build an agent that summarizes YouTube videos"
Claude transforms this into a complete product:
"A YouTube video summarization agent that accepts video URLs, extracts transcripts, and generates concise summaries using LLM inference. Features structured output with key points, timestamps, and takeaways. Includes health monitoring, graceful error handling, structured logging, and configurable summary length. Designed for developer integration via REST API."
Then Claude:
- Writes a 10-section technical spec
- Researches competitors and positioning
- Generates complete Node.js/TypeScript agent
- Runs quality assurance until it passes
PHASE 0: Intent Normalization → Upgrade "build agent that..." to product spec
PHASE 1: Dream Spec Author → 10-section comprehensive specification
PHASE 2: Research & Position → Market research, competitors, positioning
PHASE 3: Generate → Complete Node.js/TypeScript agent
PHASE 4: Ralph Polish Loop → QA until ≥97% quality (max 3 iterations)
outputs/youtube-summarizer/
├── agent.json # Agent manifest
├── package.json # npm scripts: build, start, dev
├── tsconfig.json # TypeScript config
├── src/
│ ├── index.ts # HTTP server with endpoints
│ └── lib/
│ ├── logger.ts # Structured JSON logging
│ └── errors.ts # Error handling utilities
├── research/
│ ├── market_research.md # Market opportunity
│ ├── competitor_analysis.md # Existing solutions
│ └── positioning.md # Differentiation strategy
├── AGENT_SPEC.md # Agent specification
├── RUNBOOK.md # Run instructions
├── TESTING.md # Test instructions
├── LAUNCH_CHECKLIST.md # Pre-launch checks
├── DEPLOYMENT.md # Deployment guide
└── .env.example # Environment template
Adds:
TOKEN_INTEGRATION.md- Token setup guidesrc/lib/token.ts- Token utilities- Token balance checking endpoint
| Component | Technology |
|---|---|
| Runtime | Node.js 18+ |
| Language | TypeScript |
| Interface | HTTP (REST) |
| Port | 8080 (default) |
| Logging | Structured JSON |
| Error Handling | Typed error classes |
Every agent includes:
| Method | Path | Description |
|---|---|---|
| GET | / |
Agent info and available endpoints |
| GET | /health |
Health check with uptime |
| POST | /process |
Process input and return response |
# Health check
curl http://localhost:8080/health
# Process input
curl -X POST http://localhost:8080/process \
-H "Content-Type: application/json" \
-d '{"input": "https://youtube.com/watch?v=..."}'Token integration is completely optional.
- Building a free utility agent
- MVP without monetization
- Internal tools
- Agent charges per request
- Agent rewards users with tokens
- Agent gates features based on holdings
Every agent must pass Ralph's quality checklist:
npm installcompletes without errorsnpm run buildcompiles TypeScriptnpm run devstarts server
/healthreturns 200 with status/processaccepts input and returns response- Structured logging on all requests
- Graceful error handling
- Substantive market research (not placeholder)
- Real competitors named and analyzed
- Clear differentiation strategy
cd outputs/<agent-name>
# Install dependencies
npm install
# Type check
npm run typecheck
# Build for production
npm run build
# Start development server
npm run dev
# Run validation
npm run validateAgents deploy to the Factory Launchpad or can be self-hosted.
- Push to GitHub
- Import to Launchpad
- Configure environment variables
- Deploy
- Railway, Render, Fly.io
- Docker container
- Any Node.js hosting
See DEPLOYMENT.md in each generated agent for detailed instructions.
agent-factory/
├── CLAUDE.md # Constitution (how Claude operates)
├── README.md # This file
├── schema/
│ └── agent.schema.json # Manifest schema
├── scripts/
│ ├── validate.js # Validation script
│ └── zip.js # ZIP helper (optional)
├── templates/
│ └── system/
│ ├── dream_spec_author.md
│ ├── ralph_polish_loop.md
│ └── deployment_guide.md
├── examples/
│ └── codebase-explainer/ # Reference implementation (Rig-aligned)
├── outputs/ # Generated agents (output)
└── runs/ # Execution logs
IMPORTANT: Do NOT use --legacy-peer-deps, --force, or --ignore-engines flags. These are forbidden by the Local Run Proof Gate and will cause verification failure. Always fix the actual dependency versions instead.
-
Clear npm cache:
npm cache clean --force npm install
-
Check Node version:
node --version # Need 18+ -
Use fresh install:
rm -rf node_modules package-lock.json npm install
Check if port 8080 is in use:
lsof -i :8080Use a different port:
PORT=3000 npm run devnpm run validate
# Read output for specific errorsAgent is a hard failure. Check runs/.../polish/ralph_final_verdict.md for unresolved issues.
npm installcompletesnpm run buildcompilesnpm run devstarts server/healthreturns 200- All research artifacts present
- Ralph gives PASS verdict
- Build errors
- Missing required files
- Validation errors
- Research is placeholder content
- Ralph gives 3 FAIL verdicts
- Root README: ../README.md
- Constitution: CLAUDE.md
- Mobile apps: app-factory
- Web apps: dapp-factory
agent-factory v3.0 - Describe your agent idea. Get a complete, Rig-aligned, production-ready scaffold.