Khám phá Learn Stream About Jokes
INSIDER Tony's Friends — Insider — ~2 playbook/tuần, Discord riêng, tài nguyên dựng sẵn Tham gia →
Stream
Liên kết

GoClaw: Multi-agent AI Gateway trong một Binary 25MB

· github

TL;DR

GoClaw là một multi-agent AI gateway viết bằng Go, deploy thành một file binary duy nhất, không cần runtime. Nó kết nối nhiều LLM providers với tools và channels (Telegram, Discord, Zalo…), có agent teams, delegation, evaluate loop, và security 5 lớp. Chạy ngon trên VPS 5 USD/tháng.

Nói đơn giản: Tool cho phép nhiều AI agents làm việc cùng nhau như một team, có phân công công việc, kiểm tra chất lượng, giao việc lẫn nhau — tất cả trong một binary.


Bài này dành cho ai?

1. Người muốn build AI agent infrastructure cho team

Vấn đề: LangChain/LlamaIndex thiếu multi-agent orchestration thực sự, không có per-user isolation, khó deploy production Khi nào cần: Cần nhiều agents phối hợp với nhau, có task board, quality gates, audit trail Được gì: Agent teams với shared task board, delegation có permission links, conversation handoff giữa agents, evaluate loop tự động kiểm tra output

2. Dev muốn deploy AI gateway nhẹ

Vấn đề: OpenClaw (Node.js) tốn 1GB RAM, cần infrastructure phức tạp Khi nào cần: Cần gateway chạy trên VPS rẻ, khởi động nhanh, binary đơn giản Được gì: ~25MB binary, <1s startup, ~35MB RAM idle, chạy trên $5 VPS

3. Người cần bảo mật cho AI agents

Vấn đề: Prompt injection, SSRF, credential leak — các tool hiện tại thiếu security layer đầy đủ Khi nào cần: Deploy AI agents cho nhiều users, cần per-user isolation, encrypted API keys Được gì: 5-layer defense (rate limiting, prompt injection detection, SSRF protection, shell deny patterns, AES-256-GCM encryption)


Các điểm chính

1. Agent Delegation — giao việc giữa các agents có kiểm soát Một agent có thể nhờ agent khác làm việc — sync (chờ kết quả) hoặc async (làm tiếp, không chờ). Có permission links để giới hạn ai được nhờ ai, concurrency limits per-link và per-agent. → Làm gì: Thiết lập agent links với direction (outbound/inbound/bidirectional) và maxConcurrent để tránh overload.

2. Agent Teams — shared task board và mailbox Team gồm Lead agent (điều phối) và Member agents. Có task board chung với dependencies, ai claim thì task đó được lock. Mailbox cho peer-to-peer messaging giữa các agents. → Làm gì: Dùng team khi cần workflow phức tạp — Lead phân công, members claim và report qua mailbox.

3. Evaluate Loop — generator-evaluator feedback cycle Agent A generate output, agent B evaluate theo criteria. Nếu reject thì A làm lại — max 5 rounds. Tự động quality gate trước khi output đến user. → Làm gì: Setup evaluate_loop với pass_criteria cụ thể để QA tự động, không cần human review mỗi lần.

4. Managed mode = full features Standalone mode chỉ dùng được basic agent loop và memory. Managed mode (PostgreSQL) mới có: agent teams, delegation, handoff, evaluate loops, quality gates, tracing, skills (BM25 + pgvector), MCP integration, custom tools, web dashboard. → Làm gì: Nếu cần advanced features — dùng managed mode từ đầu, đừng bắt đầu với standalone rồi migrate.

5. 11+ LLM providers với prompt caching Native Anthropic HTTP+SSE với cache_control giảm ~90% chi phí cho repeated prefixes. OpenAI-compatible providers (OpenRouter, Groq, DeepSeek…) cũng có auto prompt caching. → Làm gì: Dùng Anthropic cho agents chạy recurring tasks — cache tiết kiệm đáng kể.

6. Security 5 layers Rate limiting (token bucket), prompt injection detection (6 regex patterns), SSRF protection (DNS pinning, blocked private IPs), shell deny patterns (curl|sh, eval $(), base64|sh), AES-256-GCM encrypted API keys trong DB. → Làm gì: Managed mode + encryption key là bắt buộc nếu deploy cho nhiều users.

7. Single binary, không runtime ~25MB static Go binary, không cần Node.js. Khởi động <1s, RAM ~35MB idle. Docker image ~50MB Alpine. → Làm gì: Deploy bằng docker-compose có sẵn, hoặc build binary rồi chạy trực tiếp — không lo dependency hell.


Quick Start

1. Thử nhanh với Docker (standalone mode):

# Tạo .env với một provider API key
echo "GOCLAW_OPENROUTER_API_KEY=sk-or-your-key" > .env

# Chạy standalone
docker compose -f docker-compose.yml -f docker-compose.standalone.yml up

2. Dùng managed mode để unlock full features:

# .env
GOCLAW_OPENROUTER_API_KEY=sk-or-your-key
GOCLAW_ENCRYPTION_KEY=$(openssl rand -hex 32)
POSTGRES_USER=goclaw
POSTGRES_PASSWORD=your-password
POSTGRES_DB=goclaw

# Chạy với PostgreSQL
docker compose -f docker-compose.yml -f docker-compose.managed.yml up

Sau đó truy cập web dashboard ở http://localhost:3000 để tạo agents, teams, configure channels.


#ai-gateway #multi-agent #go #infrastructure #automation
0:00

Chia sẻ ảnh

Bắt đầu gõ để tìm kiếm...