Skip to main content

oino_agent/
lib.rs

1//! `oino-agent`: the agent runtime for Oino.
2//!
3//! Provider-agnostic agent loop: turns, steering and follow-up queues, sequential and parallel
4//! tool execution, abort, and every loop hook. It knows nothing about
5//! sessions, extensions or providers; `oino-core` supplies those through the hook traits and a
6//! [`StreamFn`].
7//!
8//! # API map
9//!
10//! | Module | Contents |
11//! |---|---|
12//! | [`tool`] | [`AgentTool`], [`ToolDefinitionMeta`], [`AgentToolResult`], [`UpdateSink`], [`ToolError`] |
13//! | [`event`] | [`AgentEvent`], [`EventSink`] |
14//! | [`config`] | [`AgentLoopConfig`], [`AgentContext`], [`StreamFn`], hook traits |
15//! | [`mod@agent_loop`] | [`agent_loop()`], [`agent_loop_continue`], [`run_tool_call`], [`declare_tool_changes`] |
16//! | [`agent`] | [`Agent`], [`AgentOptions`], [`AgentListener`], [`QueueMode`] |
17//! | [`validate`] | [`validate_tool_arguments`] |
18
19#![forbid(unsafe_code)]
20#![cfg_attr(
21    test,
22    allow(
23        clippy::unwrap_used,
24        clippy::expect_used,
25        clippy::panic,
26        reason = "tests assert by unwrapping"
27    )
28)]
29
30pub mod agent;
31pub mod agent_loop;
32pub mod config;
33pub mod event;
34pub mod tool;
35pub mod validate;
36
37pub use agent::{
38    Agent, AgentError, AgentHooks, AgentListener, AgentOptions, AgentState, QueueMode, Subscription,
39};
40pub use agent_loop::{
41    AgentLoopError, RunToolCallOptions, ToolCallOutcome, agent_loop, agent_loop_continue,
42    declare_tool_changes, now_ms, run_tool_call, tool_result_message,
43};
44pub use config::{
45    AfterToolCall, AfterToolCallContext, AfterToolCallResult, AgentContext, AgentLoopConfig,
46    AgentLoopTurnUpdate, AgentRequestUpdate, AgentTurnContext, BeforeToolCall,
47    BeforeToolCallContext, BeforeToolCallResult, ConvertToLlm, FinishTurn, GetApiKey, HookError,
48    PrepareNextTurn, PrepareRequest, PrepareRequestContext, QueueSource, StreamFn, StreamRequest,
49    ToolExecution, TransformContext, TurnDecision, default_convert_to_llm,
50};
51pub use event::{AgentEvent, EventSink};
52pub use tool::{
53    AgentTool, AgentToolResult, ExecutionMode, Replay, ToolDefinitionMeta, ToolError,
54    ToolInvocation, ToolUpdate, UpdateSink,
55};
56pub use validate::{ValidationError, check, validate_tool_arguments};