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.

Stars
★ 3.5k
Last updated
5mo ago
FARS reviewed
Nov 08, 2026
Primary language
Python

At a glance

How it runs
CLI
Works with
Platform-specificClaude API
Cost
Free software; you pay for model usage
Setup effort
Low · running in minutes
You'll need
Python 3.11+ANTHROPIC_API_KEYShell / CLINetwork accessLocal filesystem
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

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.

  1. AI developers wanting to understand the core mechanisms of AI agents through hands-on coding
  2. Teams building automation bots for Telegram or Feishu, leveraging the channel implementations
  3. Developers needing message persistence and reliable delivery, learning from s03 and s08 queue designs
  4. Users interested in proactive agent behavior and scheduled tasks, referencing s07
  5. Developers ensuring concurrency safety in multi-user or multi-channel environments, studying s10
  6. 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_KEY MODEL_ID
Config files
.env.example .env
Runtime
Python 3.11+

How do you install or deploy this agent?

  1. 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)

Local shell command execution

Can run terminal commands; pair with approval gates or container/OS sandboxing.

Local filesystem read/write

Modifies local files; work on a clean Git branch or dedicated worktree.

Outbound network access

Makes outbound requests; verify telemetry settings and model data routing on private repos.

FARS trust-control audit

Not found in source — apply before daily use
  • 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?

Pros
  • 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
Limitations
  • 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?

FollowAgents source review · FARS-2.1
Major gaps
45/ 100 5-point scale 2.3 / 5
Trust 10/29
Reliability 5/14
Adaptability 9/18
Convention 8/18
Effectiveness 9/13
Verifiability 4/8
Why each dimension lost points
Trust10 / 29 · 1.7/5

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.

Reliability5 / 14 · 1.8/5

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).

Adaptability9 / 18 · 2.5/5

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).

Convention8 / 18 · 2.2/5

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).

Effectiveness9 / 13 · 3.5/5

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).

Verifiability4 / 8 · 2.5/5

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).

Risks and how to mitigate them
  • 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.
Evidence confidence: Low Reviewed Nov 08, 2026 Reviewed revision 0fbf0eb1bd65
See the full review method →
Maintain this project? Add the FARS badge to your README

The badge shows the current review score and verdict and links back to this page. It refreshes about once an hour after a re-review.

FARS

[![FARS review](https://followagents.com/badge/claw0.svg)](https://followagents.com/en/agents/claw0)
<a href="https://followagents.com/en/agents/claw0"><img src="https://followagents.com/badge/claw0.svg" alt="FARS review"></a>

FAQ

What credentials do I need?
You need an Anthropic API key (ANTHROPIC_API_KEY) and set the model ID (MODEL_ID).
Which chat platforms are supported?
Telegram and Feishu are explicitly supported, implemented in s04.
Can I use this code in production?
The code is educational but includes production-grade concepts like retries and queues; use as a base and harden for production.
What prerequisites are required?
Python programming basics and understanding of API usage.
Was this page helpful?
View on GitHub ↗ Install ↓

Related concepts