Expand description
neuron-turn-kit
Planning and execution primitives for a single agent turn — focused on sequencing and concurrency only. These traits are intentionally narrow and do not bake in provider streaming, hooks, or operator concerns; those live at higher layers (e.g., operator implementations).
Contents:
- Concurrency and ConcurrencyDecider — classify tool calls as Shared vs Exclusive
- ToolExecutionPlanner and BarrierPlanner — sequence tool calls into batches
- SteeringSource — optional source of mid-loop steering messages
- BatchExecutor — run batches, with a simple sequential baseline executor
Example: planning with a barrier.
use neuron_turn_kit::{BarrierPlanner, Concurrency, ConcurrencyDecider, ToolExecutionPlanner};
struct SharedIfStartsWith;
impl ConcurrencyDecider for SharedIfStartsWith {
fn concurrency(&self, tool_name: &str) -> Concurrency {
if tool_name.starts_with("shared_") { Concurrency::Shared } else { Concurrency::Exclusive }
}
}
let calls = vec![
("1".to_string(), "shared_a".to_string(), serde_json::json!({})),
("2".to_string(), "exclusive".to_string(), serde_json::json!({})),
("3".to_string(), "shared_b".to_string(), serde_json::json!({})),
];
let planner = BarrierPlanner;
let plan = planner.plan(&calls, &SharedIfStartsWith);
assert!(matches!(plan[0], neuron_turn_kit::BatchItem::Shared(_)));Structs§
- Barrier
Planner - Barrier planner: batches shared tools; flushes on exclusive.
- Sequential
Batch Executor - Baseline sequential executor: executes all tool calls in order, without introducing any parallelism (Shared batches are executed one-by-one).
Enums§
- Batch
Item - Planned batches for a turn.
- Concurrency
- Concurrency hint for tool scheduling (strategy-defined).
Traits§
- Batch
Executor - Contract for executing planned batches.
- Concurrency
Decider - Decide concurrency for a tool by name.
- Steering
Source - Optional source of steering messages to inject mid-loop (provider-formatted).
- Tool
Execution Planner - Plan how to execute tool calls this turn (sequencing only).