Skip to main content
Every example lives under examples/ in the repo. They’re real, runnable programs — not snippets — and each one is shaped around a recognizable scenario, not an API tour.

How each example is shaped

Open any file and you’ll see this header at the top:
So you can decide whether the example is what you want without running it.

How to run

For LLM-backed examples, set COGNIS_PROVIDER plus the matching key. The simplest path is local Ollama — no key needed:
See Environment variables for the full provider env-var table, and Quickstart for the smallest working agent.

Categories

Quickstart V2

8 numbered demos that walk the V2 surface end-to-end. The fastest way to learn the shape of every layer.

Chains

4 examples on composition — pipe, structured extraction, typed runnables, dirty-JSON repair.

Agents

5 examples on the agent loop — ReAct, conversational memory, multi-agent, planning, streaming events.

Memory

3 examples covering the memory variants — Buffer/Window/TokenBuffer trade-offs, summary compaction, knowledge-graph triples.

Models

4 examples on LLM clients — streaming, embeddings + similarity search, length-based model routing, multimodal.

Tools

4 examples on tool definition and dispatch — typed schemas, multi-tool agent, orchestrator DAG, stateful HTTP.

Retrieval

5 examples on RAG — splitters, end-to-end pipeline, incremental indexing, cross-encoder reranking, caching.

Graphs

5 examples on Graph<S> — polling state machines, checkpointing, HITL interrupts, semantic routing, topic channels.

Observability

3 examples on observers, evaluation harness, and pre-flight health checks.

Resilience

4 examples on error handling, retry/backoff, cost-based rate limiters, SSRF guards.

Parsers

2 examples on output-fixing and retry parsers — making structured output robust against bad model JSON.

Looking for something larger?

Standalone examples show one feature at a time. For full applications that combine several layers (research assistants, code Q&A over a repo, multi-agent debate, streaming UIs, more), see Patterns.