Comprehensive guide to the entire agent lifecycle: from creation โ translation โ build โ deployment
This repository uses an automated workflow that takes agent definitions and:
Key Principle: Submit in English, everything else is automatic.
# 1. Create agent
echo '{ ... }' > src/my-agent.json
# 2. Submit PR
git add src/my-agent.json
git commit -m "feat: Add My Agent"
git push
# Done! CI handles translation + deployment
# Setup
git clone https://github.com/yourusername/defi-agents
cd defi-agents
bun install
echo "OPENAI_API_KEY=sk-xxx" > .env
# Development cycle
bun run format # Translate agents
bun run build # Build public index
bun run test # Validate everything
# Deploy (automatic on push to main)
git push origin main
defi-agents/
โโโ CNAME # Your custom domain (optional)
โโโ .env # Local environment variables (gitignored)
โ โโโ OPENAI_API_KEY=sk-xxx
โ
โโโ src/ # ๐ Agent source files (English only)
โ โโโ agent-1.json
โ โโโ agent-2.json
โ โโโ sperax-dashboard.json
โ
โโโ locales/ # ๐ 18-language translations (auto-generated)
โ โโโ agent-1/
โ โ โโโ index.json # en-US (default)
โ โ โโโ index.zh-CN.json # Chinese
โ โ โโโ index.es-ES.json # Spanish
โ โ โโโ ... (18 total)
โ โโโ agent-2/
โ โโโ ... (18 files)
โ
โโโ public/ # ๐ Build output (gitignored, generated)
โ โโโ CNAME # Copied from root during build
โ โโโ index.json # Main agent index
โ โโโ index.zh-CN.json # Localized indexes
โ โโโ agent-1.json # Individual agents
โ โโโ agent-1.zh-CN.json # Localized agents
โ โโโ schema/
โ โโโ speraxAgentSchema_v1.json
โ
โโโ .github/workflows/
โ โโโ release.yml # CI/CD automation
โ
โโโ scripts/
โโโ commands/
โ โโโ format.ts # Translation engine
โ โโโ build.ts # Build engine
โโโ builders/
โโโ agent-builder.ts # Includes CNAME copy logic
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DEVELOPMENT CYCLE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
1. CREATE AGENT
โโ Write src/agent-name.json (English only)
2. TRANSLATE (bun run format)
โโ Validate JSON schema
โโ Generate missing fields (category, examples)
โโ Call OpenAI API (GPT-4)
โโ Translate to 18 languages
โโ Create locales/agent-name/*.json (18 files)
3. BUILD (bun run build)
โโ Merge src + locales
โโ Generate public index files
โโ Copy CNAME to public/ (if exists)
โโ Create CDN-ready distribution
4. DEPLOY (automatic on push)
โโ GitHub Actions triggers
โโ Runs format โ build
โโ Deploys public/ to gh-pages branch
โโ GitHub Pages serves at your domain
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ LIVE WEBSITE โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
https://yourdomain.com/index.json
โโ Agents available in 18 languages
Create a new agent in src/:
# Create agent file
touch src/my-defi-agent.json
{
"author": "your-github-username",
"config": {
"systemRole": "You are a DeFi expert specializing in...",
"openingMessage": "Hello! I can help you with...",
"openingQuestions": ["What's the best yield strategy?", "How do I minimize impermanent loss?"]
},
"createdAt": "2024-12-21",
"examples": [
{
"role": "user",
"content": "Explain DeFi yield farming"
},
{
"role": "assistant",
"content": "Yield farming is..."
}
],
"homepage": "https://github.com/nirholas/AI-Agents-Library",
"identifier": "my-defi-agent",
"meta": {
"title": "My DeFi Agent",
"description": "Expert DeFi advisor for yield optimization",
"avatar": "๐พ",
"tags": ["defi", "yield", "optimization"],
"category": "trading"
},
"schemaVersion": 1
}
# Set API key (first time only)
echo "OPENAI_API_KEY=sk-your-key" > .env
# Run translation
bun run format
What happens:
locales/my-defi-agent/ with 18 filesOutput:
locales/
my-defi-agent/
โโโ index.json # en-US (default)
โโโ index.ar.json # Arabic
โโโ index.zh-CN.json # Simplified Chinese
โโโ ... (18 total)
bun run build
What happens:
src/ + locales/public/index.json with all agentsOutput:
public/
โโโ CNAME # Your custom domain
โโโ index.json # Main index (en-US)
โโโ index.zh-CN.json # Chinese index
โโโ my-defi-agent.json # Your agent (en-US)
โโโ my-defi-agent.zh-CN.json # Your agent (Chinese)
โโโ ... (58 agents ร 18 languages = 1,044 files)
# Serve locally to test
npx serve public
# Open http://localhost:3000/index.json
# Add source + translations
git add src/ locales/
# Commit (do NOT add public/ - it's gitignored)
git commit -m "feat: Add My DeFi Agent"
# Push to trigger CI/CD
git push origin main
GitHub Actions automatically:
bun run format (translates)bun run build (builds)public/ to gh-pages branchLive in ~5 minutes at:
https://yourusername.github.io/defi-agents/index.jsonhttps://yourdomain.com/index.json# 1. Clone repository
git clone https://github.com/yourusername/defi-agents
cd defi-agents
# 2. Install dependencies
bun install
# 3. Configure OpenAI API key
echo "OPENAI_API_KEY=sk-xxx" > .env
# Format & translate agents
bun run format
# Build public distribution
bun run build
# Run tests
bun run test
# Validate translations
bun run i18n:validate
# Clean invalid translations
bun run i18n:clean
# Lint markdown docs
bun run lint:md
# Format all code
bun run prettier
# Full release pipeline (format + build + update README)
bun run awesome
# 1. Create or edit agent
vim src/my-agent.json
# 2. Translate
bun run format
# 3. Build
bun run build
# 4. Test
bun run test
# 5. Commit
git add src/ locales/
git commit -m "feat: Add my agent"
# 6. Push (triggers CI/CD)
git push origin main
File: .github/workflows/release.yml
Triggers: Every push to main branch
Steps:
bun installbun run format (uses OPENAI_API_KEY secret)bun run awesomepublic/ to gh-pages branchSet in Repository Settings โ Secrets and variables โ Actions:
OPENAI_API_KEY - OpenAI API key for translations (required)OPENAI_PROXY_URL - Custom OpenAI endpoint (optional)GITHUB_TOKEN - Automatically provided by GitHubThe build step (bun run build) calls agent-builder.ts which:
schema/ and public/schema/src/*.json (English source)locales/agent-name/index.[locale].jsonpublic/agent-name.[locale].jsonpublic/index.[locale].jsonCNAME exists in rootpublic/CNAME (if exists)Code Reference: scripts/builders/agent-builder.ts
run = async () => {
this.buildSchema(); // Generate schema
await this.buildFullLocaleAgents(); // Build all languages
this.copyCNAME(); // Copy CNAME
};
For: Personal projects, testing, forks
# Delete CNAME file
rm CNAME
git add CNAME
git commit -m "Use default GitHub Pages domain"
git push
Your site: https://username.github.io/defi-agents/
For: Production, branded deployments
# 1. Update CNAME file
echo "yourdomain.com" > CNAME
git add CNAME
git commit -m "Set custom domain"
git push
# 2. Configure DNS (in your domain registrar)
# Add CNAME record: yourdomain.com โ username.github.io
# 3. Enable HTTPS in GitHub
# Settings โ Pages โ Enforce HTTPS (after DNS propagates)
Your site: https://yourdomain.com/
Why it works:
agent-builder.ts) copies it to public/CNAMEpublic/ directory (including CNAME)CNAME and serves site at custom domainFor forks:
sperax.click in CNAMEtheir-domain.comImplementation: scripts/builders/agent-builder.ts
copyCNAME = () => {
const cnamePath = resolve(root, 'CNAME');
const publicCNAMEPath = resolve(publicDir, 'CNAME');
if (existsSync(cnamePath)) {
copyFileSync(cnamePath, publicCNAMEPath);
Logger.success('CNAME ๆไปถๅทฒๅคๅถๅฐ public ็ฎๅฝ');
}
};
src/your-agent.jsonYou do NOT need to:
bun run format locallyCI will automatically:
src/your-agent.json# 1. Fork on GitHub
# Click "Fork" button
# 2. Clone your fork
git clone https://github.com/yourusername/defi-agents
cd defi-agents
# 3. Set up custom domain (optional)
echo "yourdomain.com" > CNAME
# Or delete CNAME for default GitHub Pages URL
# 4. Configure GitHub secrets
# Go to Settings โ Secrets โ Actions
# Add: OPENAI_API_KEY
# 5. Enable GitHub Pages
# Settings โ Pages โ Source: gh-pages branch
# 6. Push to trigger first deployment
git add CNAME # or git rm CNAME
git commit -m "Configure domain"
git push origin main
Keep agents in sync with upstream:
# Add upstream remote
git remote add upstream https://github.com/nirholas/defi-agents
# Sync with upstream
git fetch upstream
git merge upstream/main
# Rebuild with your agents
bun run format
bun run build
# Push
git push origin main
Add your own agents:
# Create agent
vim src/my-custom-agent.json
# Commit and push (CI handles rest)
git add src/my-custom-agent.json
git commit -m "feat: Add my custom agent"
git push origin main
Complete Lifecycle:
Developer โ Create agent.json โ Push to GitHub
โ
GitHub Actions CI/CD
โ
format (translate to 18 languages)
โ
build (generate public index + copy CNAME)
โ
deploy (push to gh-pages branch)
โ
GitHub Pages CDN
โ
Live at your domain in 18 languages
Key Files:
src/*.json - Source agents (English)locales/*/index.*.json - Translations (18 languages)public/ - Build output (gitignored, generated)CNAME - Custom domain (optional).github/workflows/release.yml - CI/CD automationscripts/builders/agent-builder.ts - Build logicKey Commands:
bun run format - Translate agentsbun run build - Build index (includes CNAME copy)bun run test - Validate everythinggit push origin main - Trigger deploymentQuestions? Open an issue or check the FAQ.
If GitHub Actions are disabled or you prefer Vercelโs features (CORS control, analytics, rate limiting):
bun run buildpublicOPENAI_API_KEY# Install
bun install
# Translate agents (requires OpenAI API key)
export OPENAI_API_KEY=sk-your-key
bun run format
# Build
bun run build
# Or use the convenience script
./scripts/local-release.sh
| Use Case | Recommendation |
|---|---|
| GitHub Actions enabled | GitHub Pages (automatic) |
| GitHub Actions disabled | Vercel |
| Need CORS control | Vercel |
| Need rate limiting | Vercel |
| Need analytics | Vercel |
| Simple, free hosting | Either works |
See Deployment Guide for complete details.