Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Introduction

Synaptic is a Rust agent framework with LangChain-compatible architecture.

Build production-grade AI agents, chains, and retrieval pipelines in Rust with the same mental model you know from LangChain -- but with compile-time safety, zero-cost abstractions, and native async performance.

Why Synaptic?

  • Type-safe -- Message types, tool definitions, and runnable pipelines are checked at compile time. No runtime surprises from mismatched schemas.
  • Async-native -- Built on Tokio and async-trait from the ground up. Every trait method is async, and streaming is a first-class citizen via Stream.
  • Composable -- LCEL-style pipe operator (|), parallel branches, conditional routing, and fallback chains let you build complex workflows from simple parts.
  • LangChain-compatible -- Familiar concepts map directly: ChatPromptTemplate, StateGraph, create_react_agent, ToolNode, VectorStoreRetriever, and more.

Features at a Glance

AreaWhat you get
Chat ModelsOpenAI, Anthropic, Gemini, Ollama adapters with streaming, retry, rate limiting, and caching
MessagesTyped message enum with factory methods, filtering, trimming, and merge utilities
PromptsTemplate interpolation, chat prompt templates, few-shot prompting
Output ParsersString, JSON, structured, list, enum, boolean, XML parsers
Runnables (LCEL)Pipe operator, parallel, branch, assign/pick, bind, fallbacks, retry
ToolsTool trait, registry, serial/parallel execution, tool choice
MemoryBuffer, window, summary, token buffer, summary buffer strategies
GraphLangGraph-style state machines with checkpointing, streaming, and human-in-the-loop
RetrievalLoaders, splitters, embeddings, vector stores, BM25, multi-query, ensemble retrievers
EvaluationExact match, regex, JSON validity, embedding distance, LLM judge evaluators
CallbacksRecording, tracing, composite callback handlers