Skip to content

Latest commit

 

History

History
53 lines (43 loc) · 3.36 KB

File metadata and controls

53 lines (43 loc) · 3.36 KB
title Quickstart V2 examples
description Eight numbered demos that walk the V2 surface — Runnable, agents, graphs, streaming, checkpoints, multi-agent.
sidebarTitle Quickstart V2

The numbered V2 demos are the fastest way to learn the shape of Cognis end-to-end. Each is a self-contained .rs file under examples/v2/. The LLM-backed demos (02, 03, 04, 06, 07, 08) read COGNIS_PROVIDER from the env — set it to ollama for local, or any of the other providers. Demos 01 and 05 are pure-Rust offline (no provider needed).

How to run

COGNIS_PROVIDER=ollama COGNIS_OLLAMA_MODEL=llama3.1 \
  cargo run -p cognis-examples --example 02_five_line_agent

The set

# Name What it shows Source
01 01_hello_runnable The smallest possible Runnable<I, O> impl — what your own chain step looks like. src
02 02_five_line_agent An agent in 5 lines: Client::from_envAgentBuilder::newagent.run. src
03 03_custom_graph Bypass AgentBuilder and hand-build the graph yourself, then wrap it as an Agent. src
04 04_streaming_chat Token-by-token streaming via Client::stream — what wires into a chat UI. src
05 05_checkpoint_resume Attach a Checkpointer, then time-travel through saved supersteps. src
06 06_ollama_tool_calling Calculator tool + arithmetic question — the canonical tool-calling agent loop. src
07 07_ollama_structured_output StructuredOutputParser<T> recovering a typed Recipe from free-form LLM text. src
08 08_ollama_multi_agent Sequential planner → executor handoff for a real task. src

Recommended order

Read in number order for the full guided tour. If you're impatient, jump to whichever maps to your use case:

  • Building a chat agent? → 02, then 06 for tools, then 07 for structured output.
  • Building a graph workflow? → 01, then 03, then 05 for checkpoints.
  • Building multi-agent? → 02, then 08.
  • Building a streaming UI? → 04, then Patterns → Streaming UI.

See also

The narrative walkthrough of demo 02. More agent patterns beyond the V2 set. More graph patterns beyond demo 03. Larger applications that combine multiple V2 demos.