Expand description
Tool contract for LLM integration
Tool contract and BashTool implementation.
§Public Library Contract
bashkit follows the Everruns toolkit-library contract:
ToolBuilder (config) -> Tool (metadata) -> ToolExecution (single-use runtime)BashToolBuilder configures a reusable tool definition. BashTool exposes
locale-aware metadata plus Tool::execution for validated, single-use runs.
ToolExecution returns structured ToolOutput and can optionally stream
ToolOutputChunk values during execution.
§Architecture
Tooltrait: shared metadata + execution contractBashToolBuilder: reusable builder for config, schemas, OpenAI tool JSON, andtower::ServiceintegrationBashTool: immutable metadata object implementingToolToolExecution: validated, single-use runtime for one call
§Builder Example
use bashkit::{BashTool, Tool};
let builder = BashTool::builder()
.locale("en-US")
.username("agent")
.hostname("sandbox");
let tool = builder.build();
assert_eq!(tool.name(), "bashkit");
assert_eq!(tool.display_name(), "Bash");
assert!(builder.build_tool_definition()["function"]["parameters"].is_object());§Execution Example
use bashkit::{BashTool, Tool};
use futures::StreamExt;
let tool = BashTool::default();
let execution = tool
.execution(serde_json::json!({"commands": "printf 'a\nb\n'"}))
.expect("valid args");
let mut stream = execution.output_stream().expect("stream available");
let handle = tokio::spawn(async move { execution.execute().await.expect("execution succeeds") });
let first = stream.next().await.expect("first chunk");
assert_eq!(first.kind, "stdout");
assert!(first.data.as_str().is_some_and(|chunk| chunk.starts_with("a\n")));
let output = handle.await.expect("join");
assert_eq!(output.result["stdout"], "a\nb\n");Structs§
- Bash
Tool - Virtual bash interpreter implementing the Tool trait
- Bash
Tool Builder - Builder for configuring BashTool
- Tool
Execution - Stateful, single-use tool execution.
- Tool
Image - Image payload returned by a tool.
- Tool
Output - Structured execution result.
- Tool
Output Chunk - Incremental tool output chunk.
- Tool
Output Metadata - Consumer-facing metadata that never goes to the LLM.
- Tool
Output Stream - Stream returned by
ToolExecution::output_stream. - Tool
Request - Request to execute bash commands
- Tool
Response - Response from executing a bash script
- Tool
Status - Status update during tool execution
Enums§
- Tool
Error - Tool execution error.
Constants§
- VERSION
- Library version from Cargo.toml
Traits§
- Tool
- Tool contract for LLM integration.
Type Aliases§
- Tool
Service - Standard
tower::Servicetype for toolkit integrations.