{"id":49498157,"url":"https://github.com/openclaw/cookbook","last_synced_at":"2026-05-06T16:01:11.548Z","repository":{"id":354770123,"uuid":"1224995425","full_name":"openclaw/cookbook","owner":"openclaw","description":"Example apps for the OpenClaw SDK","archived":false,"fork":false,"pushed_at":"2026-05-04T00:54:18.000Z","size":87,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-05-04T14:37:23.787Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/openclaw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["moltbot"]}},"created_at":"2026-04-29T20:55:44.000Z","updated_at":"2026-05-04T14:22:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/openclaw/cookbook","commit_stats":null,"previous_names":["openclaw/cookbook"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/openclaw/cookbook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclaw%2Fcookbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclaw%2Fcookbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclaw%2Fcookbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclaw%2Fcookbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openclaw","download_url":"https://codeload.github.com/openclaw/cookbook/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openclaw%2Fcookbook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32654618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-01T11:00:45.577Z","updated_at":"2026-05-05T15:01:35.888Z","avatar_url":"https://github.com/openclaw.png","language":"TypeScript","funding_links":["https://github.com/sponsors/moltbot"],"categories":[],"sub_categories":[],"readme":"# OpenClaw Cookbook\n\nRunnable examples for building apps, tools, and automations on the OpenClaw SDK.\n\nThis repository is the copyable companion to the public SDK. It is organized as\ntwo layers:\n\n- `recipes/`: small, one-concept TypeScript examples that show a single SDK\n  workflow.\n- `sdk/`: standalone starter apps that can be copied out and turned into real\n  products.\n\nUse the cookbook when you want to see the SDK in context: starting runs,\nstreaming events, cancelling work, reusing sessions, checking model status, and\ntesting app code without a live Gateway.\n\n## Status\n\nThe SDK package is landing in `openclaw/openclaw` first. Until `@openclaw/sdk`\nis published, this repo uses a private workspace shim named `@openclaw/sdk` so\nCI can typecheck, test, and build every example without reaching into OpenClaw\nmonorepo internals.\n\nRecipe and example source imports `@openclaw/sdk` directly. That keeps copied\ncode aligned with the real package shape once the SDK is published.\n\n## Quick Start\n\nInstall dependencies and run the full cookbook gate:\n\n```bash\npnpm install\npnpm check\n```\n\nRun the smallest local recipe:\n\n```bash\npnpm recipe:custom-transport -- \"test prompt\"\n```\n\nThat recipe uses an in-memory transport, so it does not require a running\nGateway.\n\n## Connect To A Gateway\n\nRecipes that talk to OpenClaw need a Gateway URL or local discovery. Once the\npublished SDK is available in your app, install it and point the example at your\nGateway:\n\n```bash\npnpm add @openclaw/sdk\nexport OPENCLAW_GATEWAY=auto\nexport OPENCLAW_AGENT_ID=main\npnpm recipe:run-agent -- \"Summarize this repository\"\n```\n\nUse explicit credentials for protected Gateways:\n\n```bash\nexport OPENCLAW_GATEWAY=ws://127.0.0.1:1455\nexport OPENCLAW_TOKEN=...\n```\n\n### Environment Variables\n\n| Name                          | Purpose                                                             |\n| ----------------------------- | ------------------------------------------------------------------- |\n| `OPENCLAW_GATEWAY`            | Gateway URL, or `auto` for local discovery.                         |\n| `OPENCLAW_TOKEN`              | Bearer token for protected Gateways.                                |\n| `OPENCLAW_PASSWORD`           | Password for protected Gateways.                                    |\n| `OPENCLAW_AGENT_ID`           | Agent id used by recipes. Defaults to `main`.                       |\n| `OPENCLAW_SESSION_KEY`        | Session key for recipes that reuse a conversation.                  |\n| `OPENCLAW_MODEL`              | Optional model override, such as `openrouter/deepseek/deepseek-r1`. |\n| `OPENCLAW_CANCEL_AFTER_MS`    | Delay before the cancellation recipe calls `run.cancel()`.          |\n| `OPENCLAW_MODEL_STATUS_PROBE` | Set to `1` to let the model-status recipe request provider probes.  |\n\n## Choose An Example\n\nStart with the smallest thing that matches your product shape:\n\n| Goal                                  | Start Here                                             | Why                                                   |\n| ------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------- |\n| Send one prompt and wait for a result | [`recipes/run-an-agent`](recipes/run-an-agent)         | Minimal request/response flow.                        |\n| Show live progress in a UI            | [`recipes/stream-events`](recipes/stream-events)       | Normalized event iteration with stable event types.   |\n| Add a stop button or time budget      | [`recipes/cancel-a-run`](recipes/cancel-a-run)         | First-class cancellation by run id.                   |\n| Build a chat thread                   | [`recipes/reuse-session`](recipes/reuse-session)       | Stable session keys across turns.                     |\n| Show provider/auth readiness          | [`recipes/model-status`](recipes/model-status)         | Gateway model status and optional probes.             |\n| Test without a Gateway                | [`recipes/custom-transport`](recipes/custom-transport) | In-memory transport boundary for app tests.           |\n| Build a terminal app                  | [`sdk/coding-agent-cli`](sdk/coding-agent-cli)         | One-shot prompts plus interactive slash commands.     |\n| Build a web control surface           | [`sdk/agent-workbench`](sdk/agent-workbench)           | Prompt, model, session, event, cancel, and result UI. |\n| Build an operations dashboard         | [`sdk/run-board`](sdk/run-board)                       | Run grouping by status, model, session, and activity. |\n\n## Recipes\n\n| Recipe                                         | Command                                                                    | What It Shows                                          |\n| ---------------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------ |\n| [`run-an-agent`](recipes/run-an-agent)         | `pnpm recipe:run-agent -- \"Summarize this repository\"`                     | Start a run and wait for a stable SDK result envelope. |\n| [`stream-events`](recipes/stream-events)       | `pnpm recipe:stream-events -- \"Explain this branch\"`                       | Subscribe to normalized SDK events for a run.          |\n| [`cancel-a-run`](recipes/cancel-a-run)         | `OPENCLAW_CANCEL_AFTER_MS=1500 pnpm recipe:cancel-a-run -- \"Keep working\"` | Cancel active work by run id.                          |\n| [`reuse-session`](recipes/reuse-session)       | `OPENCLAW_SESSION_KEY=cookbook-demo pnpm recipe:reuse-session`             | Create or reuse a session across multiple messages.    |\n| [`model-status`](recipes/model-status)         | `pnpm recipe:model-status`                                                 | Check configured model providers and auth status.      |\n| [`custom-transport`](recipes/custom-transport) | `pnpm recipe:custom-transport -- \"test prompt\"`                            | Test SDK code with an in-memory transport.             |\n\nThe recipe manifest lives at [`recipes/manifest.json`](recipes/manifest.json).\n\n## SDK Examples\n\n| Example                                    | Type      | What It Demonstrates                                                |\n| ------------------------------------------ | --------- | ------------------------------------------------------------------- |\n| [`quickstart`](sdk/quickstart)             | Node app  | The smallest complete run, stream, wait flow.                       |\n| [`coding-agent-cli`](sdk/coding-agent-cli) | CLI app   | One-shot and interactive terminal agent workflows.                  |\n| [`agent-workbench`](sdk/agent-workbench)   | React app | A compact control room for runs, events, cancellation, and results. |\n| [`run-board`](sdk/run-board)               | React app | Dashboard-style operator view grouped by run status.                |\n\nEach SDK example has its own `package.json`, `README.md`, `tsconfig.json`, and\n`check` script. You can copy one directory into another repository and replace\nthe workspace SDK dependency with the published `@openclaw/sdk` version.\n\n## Recipe Wrapper Example\n\n[`examples/node-cli`](examples/node-cli) is a small command-line wrapper around\nthe core recipes:\n\n```bash\npnpm example:node-cli run \"Say hello\"\npnpm example:node-cli stream \"Explain this branch\"\npnpm example:node-cli models\npnpm example:node-cli session\n```\n\nIn a real app, keep recipe logic in small library functions and keep the CLI\nresponsible for argument parsing, output formatting, and exit codes.\n\n## Development\n\nThe root gate matches CI:\n\n```bash\npnpm check\n```\n\nIndividual checks:\n\n```bash\npnpm format:check\npnpm typecheck\npnpm test\npnpm docs:check\npnpm examples:check\n```\n\nUseful targeted commands:\n\n```bash\npnpm recipe:run-agent -- \"Summarize this repository\"\npnpm --filter @openclaw/cookbook-quickstart check\npnpm --filter @openclaw/cookbook-agent-workbench dev\n```\n\n## Adding Examples\n\nRecipes should be small, runnable, and copyable:\n\n1. Add `recipes/\u003cid\u003e/README.md`.\n2. Add `recipes/\u003cid\u003e/index.ts`.\n3. Register it in [`recipes/manifest.json`](recipes/manifest.json).\n4. Add or update coverage in [`test/recipes.test.ts`](test/recipes.test.ts).\n5. Run `pnpm check`.\n\nStandalone SDK examples live under `sdk/\u003cname\u003e`. Include a local README,\n`package.json`, `tsconfig.json`, and a `check` script, then add the example to\nthis README and [`scripts/check-docs.mjs`](scripts/check-docs.mjs).\n\n## License\n\nMIT. See [`LICENSE`](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclaw%2Fcookbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenclaw%2Fcookbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenclaw%2Fcookbook/lists"}