Skip to content

docs(examples): one-command docker-compose quickstart - #135

Merged
prashar32 merged 1 commit into
mainfrom
feat/quickstart-compose
Jun 14, 2026
Merged

docs(examples): one-command docker-compose quickstart#135
prashar32 merged 1 commit into
mainfrom
feat/quickstart-compose

Conversation

@prashar32

Copy link
Copy Markdown
Owner

Lowers time-to-first-value: examples/quickstart-compose is a docker compose up demo that shows RiskKernel hard-stopping a runaway agent — no API key, no local Go/Python.

What it does

cd examples/quickstart-compose && docker compose up
  call 1  -> 200 OK    tokens=1600  cost=$0.007000
  ...
  call 5  -> 200 OK    tokens=1600  cost=$0.007000
  call 6  -> HTTP 402   RiskKernel HALTED the run:
      {"code":"loop_budget_exceeded","message":"run halted: loop_budget_exceeded"}

How (three tiny services)

  • mock-llm (nginx:alpine) — a stand-in OpenAI-compatible upstream returning one canned completion with token usage, so the demo needs no real provider or key.
  • riskkernel — the daemon with a hard RISKKERNEL_DEFAULT_LOOPS=5 (other dimensions unlimited, so the halt reason is unambiguous), forwarding to the mock via RISKKERNEL_OPENAI_BASE_URL.
  • sample-agent (curlimages/curl) — a minimal shell loop that calls the proxy under one run id and never stops on its own; RiskKernel stops it.

A short README shows how to swap the mock for a real provider (still one env var on the app side).

Notes

  • The daemon service sets pull_policy: always — during testing a stale cached :latest (a pre-release v0.2.0 dev build) made the override silently no-op, so the demo must guarantee a fresh image.
  • gpt-4o is in the pricing table, so the demo also shows real per-call cost as a bonus; the loop budget is the deterministic killer either way.

Verified

Brought the stack up end-to-end (docker compose up --exit-code-from sample-agent): calls 1–5 metered at 1600 tokens each, call 6 halted with loop_budget_exceeded, compose exit code 0, no API key. docker compose config validates and sh -n agent.sh is clean.

Closes #95

Add examples/quickstart-compose: a 'docker compose up' demo that shows the
deterministic loop budget hard-stopping a runaway agent with no API key and no
local Go/Python setup — the fastest path to first value.

Three small services: a mock OpenAI-compatible upstream (nginx, one canned
completion with token usage) so no real provider or key is needed; the RiskKernel
daemon with a hard loop budget of 5 forwarding to the mock; and a tiny shell
'agent' that just loops through the proxy under one run id and never stops on its
own. RiskKernel kills it on the 6th call with HTTP 402 loop_budget_exceeded.

The daemon service sets pull_policy: always so a stale locally-cached :latest
can't make the demo behave like an older build (caught exactly this in testing).
The README shows how to swap the mock for a real provider — still one env var on
the app side. Linked from the main README quickstart.

Verified end-to-end: docker compose up meters calls 1-5 (1600 tokens each) and
halts call 6 with loop_budget_exceeded, exit code 0, no key required.
@prashar32
prashar32 merged commit bc55451 into main Jun 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quickstart: a copy-paste docker-compose for the proxy + a sample app

1 participant