neuron-turn 0.4.0

Shared toolkit for building operators — Provider trait, types, context strategy
Documentation

neuron-turn

Shared toolkit for building LLM providers and operators

crates.io docs.rs license

Overview

neuron-turn is the shared toolkit that concrete providers (Anthropic, OpenAI, Ollama) and operators (ReAct, single-shot) build on top of. It provides:

  • Provider trait — the async interface that every LLM integration implements
  • Request / response typesTurnRequest, TurnResponse, ContentPart, ToolCall, etc.
  • Context strategy typesContextStrategy enum and its resolution logic (used by providers to window conversation history before sending to the model)
  • Shared cost / token accountingTokenUsage, Cost, DurationMs

Usage

[dependencies]
neuron-turn = "0.4"

Implementing a custom provider

use neuron_turn::{Provider, TurnRequest, TurnResponse};
use async_trait::async_trait;

pub struct MyProvider { /* ... */ }

#[async_trait]
impl Provider for MyProvider {
    async fn turn(&self, request: TurnRequest) -> Result<TurnResponse, neuron_turn::TurnError> {
        // call your LLM API here
        todo!()
    }
}

Part of the neuron workspace

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