architecture
FreeReferences Serverless OpenClaw architecture. Covers network design, CDK stack structure, DynamoDB data model, API protocols, and container design.
The English summary is being prepared. Showing the original description.
References OpenClaw internals and integration points. Covers Gateway protocol, agent runtime, session management, tool system, and serverless integration. Use when working with OpenClaw APIs or debugging agent behavior.
The English summary is being prepared. Showing the original description.
Run score Not tested
See how to installReview the instructions the agent will receive before you install.
Full analysis: docs/openclaw-analysis.md
| Property | Value |
|---|---|
| Version pinned | v2026.2.13 (v2026.2.14 breaks — default-deny scope) |
| Codebase size | ~675K lines TypeScript |
| Runtime | Node.js >=22.12.0, pnpm monorepo, tsdown bundler |
| Gateway WS port | :18789 |
| HTTP port | :18790 |
| Config path | ~/.openclaw/openclaw.json (NOT ~/.config/openclaw/) |
| Session files | ~/.openclaw/agents/{id}/sessions/{sid}.jsonl |
| Entry | Purpose |
|---|---|
runEmbeddedPiAgent() | Run agent in-process, independent of Gateway WS server — the key Lambda integration point |
extensionAPI.js | Library entry point (NOT in package.json exports map — must use file:// URL import) |
openclaw gateway run | Start full Gateway WS server (subcommand required, plain openclaw gateway just waits) |
// Correct import pattern for Lambda
const ocRoot = process.env.OPENCLAW_ROOT!;
const { extensionAPI } = await import(`file://${ocRoot}/dist/extensionAPI.js`);
SessionManager.open(id) — synchronous fs read, JSONL format[] if session file is missing (safe to call on first run)SessionLock prevents concurrent access to same session (critical for Lambda concurrency)1. GW → client: { type: "event", event: "connect.challenge", data: { challenge } }
2. client → GW: { type: "req", id: 1, method: "connect", params: { client: { id: "gateway-client", mode: "backend" }, response: <challenge-response> } }
3. GW → client: { type: "res", id: 1, result: { status: "hello-ok", snapshot: { sessionDefaults: { mainSessionKey } } } }
// sessionKey obtained from hello-ok snapshot
{ type: "req", id: 2, method: "chat.send", params: { sessionKey, message: "..." } }
// Stream chunks
{ type: "event", event: "chat", data: { state: "delta", content: "..." } }
// Final
{ type: "event", event: "chat", data: { state: "final", content: "..." } }
// Error
{ type: "event", event: "chat", data: { state: "error", error: "..." } }
client Field Valuesclient.id: "cli", "gateway-client", "webchat-ui", etc. (TypeBox Literal)client.mode: "cli", "backend", "ui", "node" — NOT "operator" (invalid)device field: Optional — omit entirely (empty publicKey/signature strings fail validation){
"gateway": { "mode": "local" },
"auth": { "method": "env" }
}
auth.method key: removed in recent versions (invalid if present)gateway.mode: "local" required for embedded operationopenclaw.json| Blocker | Problem | Solution |
|---|---|---|
| Persistent WS server | Always-running :18789 | Use runEmbeddedPiAgent() instead |
| Long-lived runs (10 min) | Lambda timeout | Lambda 15-min timeout + structured streaming |
| In-process tools (filesystem) | /tmp only in Lambda | HOME=/tmp, sessions in /tmp |
| SQLite vector store | Write access needed | /tmp mount |
| Plugin loading (~30-35s) | Cold start overhead | Bedrock discovery disabled, pre-loaded |
| Bedrock auto-discovery | 56s scan on startup | bedrockDiscovery.enabled: false |
| Aspect | Fargate (Phase 1) | Lambda (Phase 2) |
|---|---|---|
| Entry | openclaw gateway run | runEmbeddedPiAgent() |
| Session state | Persistent (~/.openclaw) | /tmp (ephemeral) |
| Cold start | 40-57s | 1.35s |
| Concurrent users | 1 per task | Many (separate invocations) |
| Cost | ~$0/month idle | Per-invocation |
No reviews yet. Tell others what you thought.
No login needed. Share how it worked for you, ask a question, or note where it did not run.
No comments yet. Be the first to write one.
References Serverless OpenClaw architecture. Covers network design, CDK stack structure, DynamoDB data model, API protocols, and container design.
The English summary is being prepared. Showing the original description.
References cold start optimization history and techniques. Covers Docker image optimization, Fargate CPU tuning, SOCI lazy loading, and Lambda Bedrock discovery fix. Use when optimizing startup performance.
The English summary is being prepared. Showing the original description.
Loads Serverless OpenClaw project context. Provides background knowledge needed for development including project overview, tech stack, architecture decisions, and data models.
The English summary is being prepared. Showing the original description.
References Serverless OpenClaw cost optimization guidelines. Validates that no resources exceeding the cost target ($1/month) are created during implementation. Use when writing CDK stacks or making infrastructure changes.
The English summary is being prepared. Showing the original description.
Deploys Serverless OpenClaw CDK stacks to AWS. Handles SecretsStack parameter injection, full/individual stack deployment, and Docker image push.
The English summary is being prepared. Showing the original description.
Development workflow guide. Covers build, test, lint, format commands, package structure, Git hooks, TDD methodology, and coding conventions. Use when setting up dev environment, running tests, or following project conventions.
The English summary is being prepared. Showing the original description.