klieo-macros 0.9.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.

Direct klieo-core dependency required

The #[tool] macro emits absolute paths to ::klieo_core::* types. Your Cargo.toml must therefore depend on klieo-core directly, even if every klieo-core symbol you use comes through the klieo umbrella:

[dependencies]
klieo-core   = "0.7"
klieo        = { version = "0.7", features = ["macros", "tools"] }
klieo-macros = "0.7"

cargo machete flags klieo-core as unused. Silence the warning explicitly:

[package.metadata.cargo-machete]
# Required by klieo-macros: the #[tool] proc-macro emits
# ::klieo_core:: paths that the proc-macro resolver needs as a
# direct dependency, even though application code goes through
# the klieo umbrella.
ignored = ["klieo-core"]

(This requirement is on the carryover list to eliminate in a future release — the macro would route paths through the umbrella re-export instead.)

Status

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

License

MIT — see LICENSE.