klieo-macros 0.36.0

Procedural macros for the klieo agent framework: #[tool] derives a Tool impl from an async fn.
Documentation

klieo-macros

Procedural macros for the klieo agent framework: #[tool] derives a Tool impl from an async fn.

Part of the klieo Rust agent framework.

The #[tool] macro

use klieo::tool::ToolCtx;
use klieo::ToolError;
use klieo_macros::tool;

/// Return current UTC time as an RFC 3339 timestamp string.
#[tool(description = "Return current UTC time as RFC 3339")]
async fn current_time(_ctx: &ToolCtx) -> Result<String, ToolError> {
    Ok(chrono::Utc::now().to_rfc3339())
}

The macro generates a CurrentTime struct implementing klieo_core::Tool with the function body as the invoke impl and a JSON schema derived from the function's argument types.

Path resolution

The #[tool] macro emits absolute paths through the klieo umbrella's hidden __private re-export module (::klieo::__private::klieo_core::__macro_support::…), so the only dependency a downstream crate needs is klieo itself:

[dependencies]
klieo = { version = "0.16", features = ["macros", "tools"] }

klieo-macros and klieo-core come in transitively. The cargo-machete.ignored workaround required in 0.15 and earlier is no longer necessary.

Status

0.9.x — public API stable. See docs/SEMVER.md.

License

MIT — see LICENSE.