Skip to main content

Crate brainwires_tool_runtime

Crate brainwires_tool_runtime 

Source
Expand description

brainwires-tool-runtime — the execution-runtime half of the Brainwires tool surface. Companion crate to brainwires-tool-builtins (the concrete tools), unified by the brainwires-tools façade.

§What lives here

§Feature-gated runtime modules

  • orchestrator (or orchestrator-wasm) — orchestrator::OrchestratorTool (Rhai script executor).
  • oauth — OAuth 2.0 client, PKCE, pluggable token store.
  • openapi — OpenAPI 3 spec → tool descriptor conversion.
  • sandboxsandbox_executor::SandboxedToolExecutor (wraps any ToolExecutor to route bash/code-exec through brainwires-sandbox).
  • sessionssessions::SessionsTool (sessions_list, sessions_history, sessions_send, sessions_spawn) over a brainwires-session::SessionBroker.
  • ragtool_embedding::ToolEmbeddingIndex backing ToolSearchTool’s semantic mode.

Concrete builtin tools (bash, file_ops, git, web, search, code_exec, interpreters, browser, email, calendar, system, semantic_search) live in brainwires-tool-builtins. The umbrella brainwires-tools façade re-exports both crates.

Re-exports§

pub use error::ResourceType;
pub use error::RetryStrategy;
pub use error::ToolErrorCategory;
pub use error::ToolOutcome;
pub use error::classify_error;
pub use executor::PreHookDecision;
pub use executor::ToolExecutor;
pub use executor::ToolPreHook;
pub use registry::ToolCategory;
pub use registry::ToolRegistry;
pub use sanitization::contains_sensitive_data;
pub use sanitization::filter_tool_output;
pub use sanitization::is_injection_attempt;
pub use sanitization::redact_sensitive_data;
pub use sanitization::sanitize_external_content;
pub use sanitization::wrap_with_content_source;
pub use smart_router::analyze_messages;
pub use smart_router::analyze_query;
pub use smart_router::get_context_for_analysis;
pub use smart_router::get_smart_tools;
pub use smart_router::get_smart_tools_with_mcp;
pub use smart_router::get_tools_for_categories;
pub use tool_search::ToolSearchTool;
pub use transaction::TransactionManager;
pub use validation::ValidationTool;
pub use validation::get_validation_tools;
pub use orchestrator::OrchestratorTool;
pub use openapi::HttpMethod;
pub use openapi::OpenApiAuth;
pub use openapi::OpenApiEndpoint;
pub use openapi::OpenApiParam;
pub use openapi::OpenApiTool;
pub use openapi::execute_openapi_tool;
pub use openapi::openapi_to_tools;
pub use sandbox_executor::SandboxedToolExecutor;
pub use sessions::SessionsTool;
pub use tool_embedding::ToolEmbeddingIndex;

Modules§

error
Tool-error taxonomy + retry classification. Tool Error Taxonomy and Classification
executor
ToolExecutor trait + pre-hook surface. Tool Executor trait
oauth
OAuth 2.0 client, PKCE, pluggable token store. OAuth 2.0 middleware for tool integrations.
openapi
OpenAPI 3 spec → tool descriptor conversion. OpenAPI Tool Generation — Automatically create tools from OpenAPI 3.x specs
orchestrator
Rhai-script orchestration tool. Tool Orchestrator - Rhai-based tool orchestration for AI agents
registry
Composable tool registry + category metadata. Tool Registry - Composable container for tool definitions
sandbox_executor
Container-sandbox executor wrapper. Sandboxed tool executor decorator.
sanitization
Content-source tagging, injection detection, sensitive-data redaction. Prompt-injection sanitization and sensitive-data filtering for external content.
sessions
SessionsTool + companion types over brainwires-session::SessionBroker. Session-control tools exposed to the agent.
smart_router
Query-driven category filter (analyze_query, get_smart_tools). Smart Tool Router
tool_embedding
RAG-backed tool-embedding index (powers ToolSearchTool’s semantic mode). ToolEmbedding - Semantic tool discovery via embedding similarity
tool_search
Meta-tool for keyword / regex / (with rag) semantic tool discovery. Tool Search - Meta-tool for discovering available tools dynamically
transaction
Idempotency + staging-area bookkeeping for file-mutating tools. Two-phase commit transaction manager for file write operations.
validation
Code-quality checks (duplicates, syntax, build). Validation tools for agents to verify their work

Structs§

CommitResult
Result returned by a successful StagingBackend::commit.
IdempotencyRecord
Record of a completed idempotent write operation.
IdempotencyRegistry
Shared registry that deduplicates mutating file-system tool calls within a run.
StagedWrite
A single write operation that has been staged but not yet committed.
Tool
A tool that can be used by the AI agent
ToolContext
Execution context for a tool.
ToolInputSchema
JSON Schema for tool input
ToolResult
Result of a tool execution

Traits§

StagingBackend
Trait for staging write operations before committing to the filesystem.