1 unstable release
Uses new Rust 2024
| new 0.4.0 | Mar 3, 2026 |
|---|
#2736 in Asynchronous
Used in 4 crates
240KB
4.5K
SLoC
neuron-op-react
ReAct operator for neuron — model + tools in a reasoning loop
Overview
neuron-op-react implements the
ReAct (Reason + Act) operator pattern: a loop that
repeatedly calls a model, processes tool calls the model emits, feeds results back, and continues
until the model produces a final answer or a budget limit is hit.
The loop terminates when:
- The model returns a final text response with no tool calls
- A configured
max_turnsis exceeded - A
max_costormax_durationbudget is exhausted
All termination reasons are surfaced in the OperatorOutput via ExitReason.
Usage
[dependencies]
neuron-op-react = "0.4"
neuron-turn = "0.4"
neuron-tool = "0.4"
neuron-hooks = "0.4"
use neuron_op_react::ReactOperator;
use neuron_turn::OperatorConfig;
use std::sync::Arc;
let operator = ReactOperator::new(
Arc::new(my_provider),
Arc::new(tool_registry),
Arc::new(hook_registry),
);
let output = operator.invoke(input, &env).await?;
Configuration
let config = OperatorConfig {
max_turns: Some(10),
max_cost: Some(dec!(0.50)), // USD
max_duration: Some(Duration::from_secs(30)),
..Default::default()
};
Part of the neuron workspace
neuron is a composable async agentic AI framework for Rust. See the book for architecture and guides.
Dependencies
~1.5–2.7MB
~55K SLoC