neuron-context 0.4.0

Context strategy implementations for neuron-turn
Documentation

neuron-context

Context window management strategies for neuron operators

crates.io docs.rs license

Overview

neuron-context implements the ContextStrategy types used by providers to manage conversation history before sending requests to an LLM. As conversations grow, context strategies control what messages are kept, trimmed, or summarized to fit within a model's context window.

Built-in strategies:

Strategy Behaviour
Unlimited No windowing — all history is sent (default, risky for long conversations)
LastN { n } Keep only the last n turns
MaxTokens { limit } Trim oldest messages until estimated token count is within limit

Usage

[dependencies]
neuron-context = "0.4"
neuron-turn = "0.4"
use neuron_context::ContextStrategy;
use neuron_turn::TurnRequest;

let strategy = ContextStrategy::LastN { n: 10 };
// Pass to a provider or operator that accepts ContextStrategy

Part of the neuron workspace

neuron is a composable async agentic AI framework for Rust. See the book for architecture and guides.