Skip to main content

Crate echo_macros

Crate echo_macros 

Source
Expand description

§echo-macros

Procedural macros for the echo-agent framework.

§Macros

MacroGeneratesDescription
#[tool]Tool implAuto-generates params struct, JSON Schema, and Tool trait impl from an async fn
#[callback]AgentCallback implGenerates lifecycle callbacks from an impl block
#[guard]Guard implContent filtering guard from an async fn
#[handler]HumanLoopHandler implHuman-in-the-loop handler from an impl block
#[compressor]ContextCompressor implContext compression strategy from an async fn
#[permission_policy]PermissionPolicy implTool permission policy from an async fn
#[audit_logger]AuditLogger implAudit 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 AuditLogger implementation from an impl block.
callback
Generate an AgentCallback implementation from an impl block, overriding only the methods you define.
compressor
Generate a ContextCompressor implementation from an async function.
guard
Generate a Guard implementation from an async function.
handler
Generate a HumanLoopHandler implementation from an impl block.
permission_policy
Generate a PermissionPolicy implementation from an async function.
tool
Generate a Tool implementation from an async function, auto-creating the parameter struct and JSON Schema.