autoagents_core/tool/runtime/mod.rs
1use super::ToolCallError;
2use async_trait::async_trait;
3use std::fmt::Debug;
4
5#[cfg(feature = "wasmtime")]
6#[cfg(not(target_arch = "wasm32"))]
7mod wasm;
8
9#[cfg(feature = "wasmtime")]
10#[cfg(not(target_arch = "wasm32"))]
11pub use wasm::{WasmRuntime, WasmRuntimeError};
12
13/// Runtime behavior for tools.
14#[async_trait]
15pub trait ToolRuntime: Send + Sync + Debug {
16 /// Execute the tool with the provided JSON arguments, returning a JSON
17 /// value on success or a `ToolCallError` on failure.
18 async fn execute(&self, args: serde_json::Value) -> Result<serde_json::Value, ToolCallError>;
19}