claw0: Build an AI Agent Gateway from Scratch
Learn to build a production-grade AI agent gateway from zero to one through 10 progressive sections, covering tool use, multi-channel routing, autonomy, and concurrency.
- Source repo
- shareAI-lab/claw0
- Stars
- ★ 3.5k
- Last updated
- 5mo ago
- FARS reviewed
- Nov 08, 2026
- Primary language
- Python
- FA score
- 45/100 · Major gaps
At a glance
- How it runs
- Works with
- Platform-specificClaude API
- Cost
- Free software; you pay for model usage
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- AI developers wanting to understand the core mechanisms of AI agents through hands-on coding
- Not a fit if
- Teams wanting a production-ready gateway out of the box; this is teaching code
- Teams using OpenAI or local models only; Anthropic API is required
- Teams needing Docker or cloud deployment configs, which are not provided
- Maintenance
- Commits in the last 6 monthslast commit 2026-06-30+0.9 ★/day over 7 days
- Source review
- 45/100 · Major gaps 1 safety controls not found
What does this agent do, and when should you use it?
claw0 is an educational repository that guides developers in building an AI agent gateway from scratch, similar to OpenClaw. It comprises 10 progressive sections, each a runnable Python file introducing one core concept, from the basic agent loop to concurrency control. The code supports Telegram and Feishu channels, implements session persistence, heartbeat cron jobs, message delivery queues, and resilience mechanisms like retries and auth rotation. By the end, learners can read OpenClaw's production codebase with confidence. The repository provides English, Chinese, and Japanese versions of code and docs.
Each section is a standalone Python script demonstrating a specific aspect of the agent gateway. For instance, s01 implements the basic agent loop (while True + stop_reason), s02 adds tool use via a dispatch table, s03 implements JSONL session persistence, s04 integrates Telegram and Feishu channels, s05 implements gateway routing with 5-tier binding, s06 introduces agent personality via files like SOUL.md, s07 adds heartbeat and scheduled tasks, s08 implements a message queue, s09 implements retry and auth rotation, and s10 implements named-lane concurrency. Users run these scripts with an Anthropic API key to experience building a gateway step-by-step.
- AI developers wanting to understand the core mechanisms of AI agents through hands-on coding
- Teams building automation bots for Telegram or Feishu, leveraging the channel implementations
- Developers needing message persistence and reliable delivery, learning from s03 and s08 queue designs
- Users interested in proactive agent behavior and scheduled tasks, referencing s07
- Developers ensuring concurrency safety in multi-user or multi-channel environments, studying s10
- Those wanting to give agents a personality and memory, exploring s06
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Environment variables
ANTHROPIC_API_KEYMODEL_ID- Config files
.env.example.env- Runtime
- Python 3.11+
How do you install or deploy this agent?
- Clone the repo:
git clone https://github.com/shareAI-lab/claw0.git && cd claw0. 2. Install dependencies:pip install -r requirements.txt. 3. Copy .env.example to .env and edit to set ANTHROPIC_API_KEY and MODEL_ID. 4. Ensure Python 3.11+.
How do you use this agent?
Run any section (e.g., English): python sessions/en/s01_agent_loop.py. Study sections in order, as each builds on previous ones; for example, s03 depends on s02, s04 on s03, and so on. It's recommended to run from s01 to s10 sequentially and read the accompanying .md docs.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Modifies local files; work on a clean Git branch or dedicated worktree.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- rollback or recovery path — Back up first, or work on a git branch or snapshot, so its changes can be undone.
What are this agent's strengths and limitations?
- Progressive pedagogy, each section adds one concept while retaining prior code
- Three language versions (English, Chinese, Japanese) with co-located code and docs
- Covers production-grade features: auth rotation, retry onion, concurrency control
- Provides clear dependency graphs and architecture diagrams
- Runnable and beginner-friendly
- Only supports Anthropic API, requiring its API key
- No Docker or cloud deployment config, requires manual deployment
- Teaching code may simplify real-world production complexities
- No explicit test coverage or production readiness assurances
How does this agent compare with similar options?
The repository mentions a companion project, learn-claude-code, which focuses on the internal design of an agent (planning, context compression, team coordination), while claw0 focuses on gateway routing, channels, and proactive behavior.
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| claw0: Build an AI Agent Gateway from Scratch This agent | 45 · Major gaps | CLIFree + model costs | ★ 3.5k | 5mo ago | Python | Claude API |
| Claude Code From Scratch | 62 · Some gaps | CLIFree + model costs | ★ 2.9k | 3d ago | HTML | OpenAI API · Claude API |
| Learn Claude Code: Harness Engineering for Real Agents | 57 · Major gaps | CLIFree + model costs | ★ 81k | 18d ago | Python | Claude API |
| Donggua's AI Learning Notes: In-depth Pi-Agent SDK Tutorial | 49 · Major gaps | Web appFree | ★ 3.8k | 3mo ago | MDX | — |
How does FollowAgents rate this agent?
Why each dimension lost points
The README describes gateway layers, message flow, persistence, and external channels, and gives API-key configuration steps, so data flows are partly visible (2). The sample does not explain tool permission boundaries, action confirmation, secret protection, controls for delivery side effects, or recovery. Dependencies have minimum versions but no security policy. The repository is attributed to shareAI-lab, while maintenance ownership and update path are unclear.
The README clearly describes the ten sections, their dependencies, and the code/document layout, which is reasonably self-consistent (2). Dependencies have minimum versions only, with no pinning or availability guidance (1); the supplied material provides no evidence about error handling or failure messages (0).
The material targets developers learning gateway construction step by step and covers channels, routing, memory, scheduled tasks, and concurrency (2). Permission boundaries and unsuitable scenarios are unspecified, while trigger details appear only in the sample /example skill and section descriptions (1 each). Python 3.11+, an Anthropic-compatible API, and multilingual documentation provide useful environment guidance (2).
The README supplies multilingual entry points, a section index, dependency graph, file layout, and quick start, giving it strong information architecture (3). Installation and configuration steps are present but platform details are limited (2). Section and script names are reasonably stable, and the sample skill shows a simple format; there is no FAQ (2 each). Limitations are only partly described; MIT appears in the README while license metadata is unknown; no version history or maintenance responsibility appears in the supplied material (1, 1, 0, 0).
Ten progressive sections each have Python files and documentation, and the layout and sample skill support learning and reuse (2). Progressing from a single API call to gateways, channels, and reliable delivery offers clear learning value (2). Cost-benefit discussion is limited to the learning path and Python/API prerequisites, without resource costs or runtime overhead details (2).
The README gives concrete structural detail for its section, dependency, and layout claims, making them partly traceable (2). The supplied material includes only the README, dependency list, and one sample skill, so the main implementation claims cannot be corroborated across sources (1). The README mixes teaching goals, architecture descriptions, and capability summaries without clearly distinguishing facts from inference (1).
- Not found in source: rollback or recovery pathBack up first, or work on a git branch or snapshot, so its changes can be undone.
- This is a low-confidence review of the supplied static material; the full source was not provided, so README claims about implementation are not confirmed.
- Running examples involves API keys and external channels; the supplied material does not show permission controls, secret protection, delivery confirmation, or recovery measures.
FAQ
What credentials do I need?
Which chat platforms are supported?
Can I use this code in production?
What prerequisites are required?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.