Skip to main content

vv_agent/
lib.rs

1//! VectorVein agent runtime, SDK, CLI, tools, memory, prompt, and workspace APIs.
2//!
3//! This crate exposes a stable Rust library surface for building and running
4//! agent workflows with built-in tool dispatch and vv-llm backed chat clients.
5
6pub mod agent;
7pub mod approval;
8pub mod cli;
9pub mod config;
10pub mod constants;
11pub mod context;
12pub mod context_providers;
13pub mod event_store;
14pub mod events;
15pub mod execution_mode;
16pub mod guardrails;
17pub mod handoffs;
18pub mod integrations;
19pub mod llm;
20pub mod memory;
21pub mod model;
22pub mod model_settings;
23pub mod prompt;
24pub mod result;
25pub mod run_config;
26pub mod run_handle;
27pub mod runner;
28pub mod runtime;
29pub mod sessions;
30pub mod skills;
31pub mod tools;
32pub mod tracing;
33pub mod types;
34pub mod workspace;
35
36pub use agent::{Agent, ToolUseBehavior};
37pub use approval::{
38    ApprovalBroker, ApprovalError, ApprovalFuture, ApprovalProvider, ApprovalRequest,
39};
40pub use config::{
41    apply_resolved_model_limits, build_vv_llm_from_local_settings, build_vv_llm_settings,
42    decode_api_key, load_llm_settings_from_file, load_memory_summary_defaults_from_file,
43    resolve_model_endpoint, ConfigError, EndpointConfig, EndpointOption, MemorySummaryDefaults,
44    ResolvedModelConfig,
45};
46pub use context::{RunContext, ToolCallContext};
47pub use context_providers::{
48    assemble_context_fragments, collect_context_fragments, ContextBundle, ContextError,
49    ContextFragment, ContextProvider, ContextRequest, ContextSection,
50};
51pub use event_store::{
52    EventStoreError, JsonlRunEventStore, RunEventIter, RunEventReplayQuery, RunEventStore,
53};
54pub use events::{
55    AgentErrorPayload, EventId, RunEvent, RunEventPayload, RunEventVersion, ToolStatus,
56};
57pub use execution_mode::ExecutionMode;
58pub use guardrails::{GuardrailOutcome, InputGuardrail, OutputGuardrail};
59pub use handoffs::{handoff, Handoff};
60pub use llm::{
61    EndpointTarget, LlmClient, LlmError, LlmRequest, LlmStreamCallback, ScriptStep,
62    ScriptStepCallback, ScriptedLlmClient, VvLlmClient,
63};
64pub use memory::{
65    sanitize_for_resume, CompactionExhaustedError, LocalSummary, MemoryError, MemoryFuture,
66    MemoryManager, MemoryManagerConfig, MemoryProvider, MemoryProviderResult, MemorySaveRequest,
67    MemorySaveResult, MemorySearchRequest, MemorySearchResult, SessionMemory, SessionMemoryConfig,
68    SessionMemoryEntry, SessionMemoryState, SummaryCallback,
69};
70pub use model::{ModelError, ModelProvider, ModelRef, ScriptedModelProvider, VvLlmModelProvider};
71pub use model_settings::{ModelSettings, ResponseFormat, RetryPolicy, ToolChoice};
72pub use result::{RunResult, RunState};
73pub use run_config::RunConfig;
74pub use run_handle::{RunHandle, RunHandleState, RunHandleStatus};
75pub use runner::{NormalizedInput, RunEventStream, Runner};
76pub use runtime::backends::{
77    run_checkpointed_cycle, CycleDispatchResult, CycleDispatcher, DistributedBackend,
78    InlineBackend, RuntimeExecutionBackend, RuntimeRecipe, ThreadBackend,
79};
80pub use runtime::background_sessions::{
81    background_session_manager, BackgroundSessionAdoptOptions, BackgroundSessionListener,
82    BackgroundSessionManager, BackgroundSessionStartOptions, BackgroundSessionSubscription,
83};
84pub use runtime::shell::{
85    build_shell_invocation, prepare_shell_execution, resolve_shell_invocation,
86    PreparedShellCommand, ShellInvocation,
87};
88pub use runtime::state::{Checkpoint, InMemoryStateStore, StateStore};
89pub use runtime::stores::redis::RedisStateStore;
90pub use runtime::stores::sqlite::SqliteStateStore;
91pub use runtime::sub_task_manager::{
92    ManagedSubTask, ManagedSubTaskSnapshot, SubTaskManager, SubTaskSessionAttachment,
93};
94pub use runtime::{
95    _register_sub_agent_session, _unregister_sub_agent_session, continue_sub_agent_session,
96    get_sub_agent_session, register_sub_agent_session, steer_sub_agent_session,
97    sub_agent_session_registry, subscribe_sub_agent_session, unregister_sub_agent_session,
98    AfterLlmEvent, AfterToolCallEvent, AgentRuntime, BeforeCycleMessageProvider, BeforeLlmEvent,
99    BeforeLlmPatch, BeforeMemoryCompactEvent, BeforeToolCallEvent, BeforeToolCallPatch,
100    CancellationToken, CancelledError, CycleRunRequest, CycleRunner, ExecutionContext,
101    InterruptionMessageProvider, RuntimeEventHandler, RuntimeHook, RuntimeHookManager,
102    RuntimeRunControls, StreamCallback, SubAgentSession, SubAgentSessionListener,
103    SubAgentSessionRegistry, SubAgentSessionUnsubscribe, ToolCallRunner, ToolRunOutcome,
104    ToolRunRequest, MAX_PROMPT_TOO_LONG_RETRIES, MAX_PTL_RETRIES,
105};
106pub use sessions::{
107    session_store_conformance, MemorySession, Session, SessionItem, SessionStore,
108    SqliteSessionStore,
109};
110pub use tools::{
111    build_default_registry, dispatch_tool_call, AgentTool, AgentToolBuilder, ApprovalDecision,
112    ApprovalPolicy, ApprovalRequirement, BackgroundAgentTask, BackgroundAgentTaskBuilder,
113    BackgroundAgentTaskHandle, BackgroundAgentTaskSnapshot, FunctionTool, StaticTool, Tool,
114    ToolContext, ToolError, ToolExecutor, ToolExposure, ToolFuture, ToolHandler, ToolNotFoundError,
115    ToolOrchestrator, ToolOutput, ToolPolicy, ToolRegistry, ToolRunContext, ToolRunOptions,
116    ToolSpec, ToolSpecContext, ToolSpecExecutor, ToolSpecKind,
117};
118pub use tracing::{JsonlTraceExporter, Span, TraceSink};
119pub use types::{
120    AgentResult, AgentStatus, AgentTask, CycleRecord, CycleStatus, LLMResponse, Message,
121    MessageRole, NoToolPolicy, SubAgentConfig, SubTaskOutcome, SubTaskRequest, TaskTokenUsage,
122    TokenUsage, ToolCall, ToolDirective, ToolExecutionResult, ToolResultStatus,
123};
124pub use workspace::{
125    FileInfo, LocalWorkspaceBackend, MemoryWorkspaceBackend, S3WorkspaceBackend, S3WorkspaceConfig,
126    WorkspaceBackend,
127};