Skip to main content

Documentation Index

Fetch the complete documentation index at: https://cognis.vasanth.xyz/llms.txt

Use this file to discover all available pages before exploring further.

GitHub starscrates.iodocs.rsRust 1.75+MIT licenseCI

Build LLM agents in Rust without the duct tape.

Typed Runnable<I, O> flows from your prompt to your parsed struct. Tool schemas are checked at compile time. Memory, retries, fallbacks, rate limits, prompt caching, evals — all in the box. Six providers behind one client. Six vector stores behind one trait. One umbrella crate.
use std::sync::Arc;
use cognis::prelude::*;
use cognis::{AgentBuilder, Calculator, Client};

#[tokio::main]
async fn main() -> Result<()> {
    let mut agent = AgentBuilder::new()
        .with_llm(Client::from_env()?)
        .with_tool(Arc::new(Calculator::new()))
        .with_system_prompt("Use the calculator for arithmetic.")
        .build()?;

    let resp = agent.run(Message::human("What is 23 * 17 + 4?")).await?;
    println!("{}", resp.content);
    Ok(())
}
A real, working tool-calling agent in 11 lines. Swap COGNIS_PROVIDER between openai, anthropic, google, ollama, azure, or openrouter — same code.

Real apps you can ship today

Research assistant

Planner → researcher (with web search) → writer. Sequential multi-agent in 80 lines.

Code Q&A over a repo

Walk a Rust repo, embed code chunks, answer questions with file:line citations.

Streaming UI backend

axum SSE endpoint streaming agent tokens, tool starts, and tool results to the browser.
Five more in the Patterns gallery — multi-agent debate, long-context summarization, HITL approval, stateful chat with memory, and a fully local Ollama setup.

What you can build

Tool-calling agents

A model with tools, memory, and a loop that knows when to stop. Add middleware for retry, fallback, rate limits, PII redaction, and human approval.

Multi-agent systems

Sequential pipelines, supervisor routers, parallel-vote ensembles, round-robin load balancing, hierarchical trees. Or wire your own HandoffStrategy.

RAG pipelines

Documents → splitters → embeddings → vector store → retriever → prompt. Six vector store backends. An indexing pipeline that only re-embeds what changed.

Stateful graphs

Graph<S> with typed state and per-field reducers. Time-travel through checkpoints, pause for human approval, fan out in parallel — all type-checked at compile time.

Production observability

LLM-aware tracing into Langfuse out of the box. Token counts, USD cost per run, prompt versioning, evaluation scores — one feature flag.

Local-first apps

Run entirely against Ollama with no API keys. Swap to a hosted provider later — the agent code doesn’t change.

Why Rust

  • Compile-time guarantees. Tool schemas, message types, and graph state transitions are checked before your code runs. No “unknown variant at runtime” surprises.
  • Pay only for what you use. Every external integration is feature-gated. Your binary doesn’t include OpenAI code if you only use Anthropic.
  • Async-native. Built on tokio and futures::Stream. Streaming tokens, events, and graph state updates uses one consistent API.
  • One umbrella, full stack. cognis re-exports the foundation, LLM, RAG, and graph layers. Most apps need a single use cognis::prelude::*;.

What’s not here yet

Honest about the gaps so you can decide whether to wait or contribute:
  • LangSmith and OpenTelemetry exporters — Langfuse is the supported production backend; OTel + others are on the roadmap. The TraceExporter trait is one async method, so building your own is fast.
  • A hosted gateway / managed deployment — bring your own infra. Production patterns are documented; managed runtime isn’t shipping today.
  • A wider provider matrix — six are battle-tested; others (Groq, Together, Bedrock direct, Cohere) are open issues looking for owners.
See the full roadmap →

Where to next

Quickstart

From zero to a running agent in five minutes.

Installation

Workspace setup, feature flags, secrets handling.

Core ideas

Mental models for Runnable, graphs, and the agent loop.

Patterns

Real applications you can copy: research assistants, code Q&A, multi-agent debate, more.

API reference

Per-crate rustdoc-friendly summaries. Cross-linked to docs.rs.

Contribute

Bugs, features, integrations, docs — every contribution lane.

Like what you see? Star the repo.

Cognis is open source under MIT. Stars help other Rust devs find it.