# Sample apps (/docs/sample-apps)



{/* LAUNCH: point the GitHub links at the final sample repos. */}

Two complete apps — each a persistent web service with a login and a chat UI — that run
TokenPolice in `enforce` mode the whole time. They are published on our GitHub org; once you
have a copy, add your keys and watch the firewall meter (and, in one of them, *block*) real
LLM traffic in your [dashboard](https://app.tokenpolice.ai).

The code lives in its own repo — nothing is pasted into these docs. Each page below has the run
commands, the exact integration lines, and what to look for once it's running.

<Cards>
  <Card title="Support agent" href="/docs/sample-apps/support-agent" description="A support-desk chat that meters every turn. Python (FastAPI) and Node (Express), side by side, both on LangGraph. The steady-state 'firewall always on' pattern." />

  <Card title="Budget-aware RAG" href="/docs/sample-apps/budget-aware-rag" description="A RAG chat that reads its own budget, warns as it runs low, and degrades gracefully when TokenPolice blocks the session. This is the app that shows the firewall bite." />
</Cards>

## At a glance [#at-a-glance]

| App                  | Shows                                                                  | Language(s)   | Providers                                                                                                         | Source                                             |
| -------------------- | ---------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| **Support agent**    | Steady-state enforcement + session threading (one login = one session) | Python · Node | OpenAI · Anthropic · Gemini                                                                                       | [Our GitHub org →](https://github.com/tokenpolice) |
| **Budget-aware RAG** | The firewall *blocking* a session, with a graceful wind-down           | Python        | OpenAI · Anthropic · Gemini for chat — **an OpenAI key is always required**, because embeddings are always OpenAI | [Our GitHub org →](https://github.com/tokenpolice) |

<Callout title="Provider is a startup switch">
  In both apps you pick the LLM provider with one env var (`PROVIDER=openai | anthropic |
    gemini`) — the same app code runs on all three, no changes. The provider is read at startup, so
  restart to switch; the active provider and model are shown read-only in the UI header.
</Callout>

## Which one first? [#which-one-first]

* **New to TokenPolice?** Start with the **Support agent** — it's the plain "add the firewall,
  leave it on" integration, in whichever language you work in.
* **Want to see a block actually happen?** Go to **Budget-aware RAG** — it deliberately drives a
  session past a budget so you can watch the enforcement path and the app's graceful fallback.

Both are wired the same way you'd wire your own app — the fastest route is to let your coding
agent do it. See [Start with your coding agent](/docs/get-started/coding-agent/overview).
