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

neuron provides composable building blocks for AI agents in Rust. Each block is an independent crate, versioned and published separately. Pull one block without buying the whole stack.

Philosophy: serde, not serde_json

neuron is to agent frameworks what serde is to serde_json. It defines traits (Provider, Tool, ContextStrategy) and provides foundational implementations. An SDK layer composes these blocks into opinionated workflows.

Every Rust and Python agent framework converges on the same ~300-line while loop. The differentiation is never the loop — it’s the blocks around it: context management, tool pipelines, durability, runtime. Nobody ships those blocks independently. That’s the gap neuron fills.

What’s Included

neuron ships the following crates:

CratePurpose
neuron-typesCore traits and types — Provider, Tool, ContextStrategy, Message
neuron-provider-anthropicAnthropic Messages API (streaming, tool use, server-side compaction)
neuron-provider-openaiOpenAI Chat Completions + Embeddings API
neuron-provider-ollamaOllama local inference API
neuron-toolToolRegistry with composable middleware pipeline
neuron-tool-macros#[neuron_tool] derive macro
neuron-contextCompaction strategies, token counting, system prompt injection
neuron-loopConfigurable AgentLoop with streaming, cancellation, parallel tools
neuron-mcpModel Context Protocol client and server (stdio + Streamable HTTP)
neuron-runtimeSessions, guardrails, TracingHook, GuardrailHook, DurableContext
neuron-otelOpenTelemetry instrumentation with GenAI semantic conventions (gen_ai.* spans)
neuronUmbrella crate with feature flags for all of the above

Who Is This For?

  • Rust developers building AI-powered applications who want control over each layer of the stack
  • Framework authors who need well-tested building blocks to compose into higher-level abstractions
  • AI agents (like Claude Code) that need to understand, evaluate, and work with the codebase

What neuron Is NOT

neuron is the layer below frameworks. It does not provide:

  • CLI, TUI, or GUI applications
  • Opinionated agent framework (compose one from the blocks)
  • RAG pipeline (use the EmbeddingProvider trait with your own retrieval)
  • Workflow engine (integrate with Temporal/Restate via DurableContext)
  • Retry middleware (use tower or your durable engine’s retry policy)

Next Steps