Expand description
§echo-macros
Procedural macros for the echo-agent framework.
§Macros
| Macro | Generates | Description |
|---|---|---|
#[tool] | Tool impl | Auto-generates params struct, JSON Schema, and Tool trait impl from an async fn |
#[callback] | AgentCallback impl | Generates lifecycle callbacks from an impl block |
#[guard] | Guard impl | Content filtering guard from an async fn |
#[handler] | HumanLoopHandler impl | Human-in-the-loop handler from an impl block |
#[compressor] | ContextCompressor impl | Context compression strategy from an async fn |
#[permission_policy] | PermissionPolicy impl | Tool permission policy from an async fn |
#[audit_logger] | AuditLogger impl | Audit logging backend from an impl block |
§Quick Example
ⓘ
use echo_agent::tool;
#[tool(name = "add", description = "Add two numbers")]
async fn add(a: f64, b: f64) -> Result<ToolResult> {
Ok(ToolResult::success(format!("{}", a + b)))
}Most users should import these macros via echo_agent::prelude::* or
use echo_agent::{tool, callback, guard, handler}; rather than depending
on echo_macros directly.
Attribute Macros§
- audit_
logger - Generate an
AuditLoggerimplementation from an impl block. - callback
- Generate an
AgentCallbackimplementation from an impl block, overriding only the methods you define. - compressor
- Generate a
ContextCompressorimplementation from an async function. - guard
- Generate a
Guardimplementation from an async function. - handler
- Generate a
HumanLoopHandlerimplementation from an impl block. - permission_
policy - Generate a
PermissionPolicyimplementation from an async function. - tool
- Generate a
Toolimplementation from an async function, auto-creating the parameter struct and JSON Schema.