Expand description
Attribute macros for serve, the
experimental agent framework in the Everruns
ecosystem.
Each attribute keeps the annotated item callable exactly as written and adds
a link-time registration (via inventory) that App::builder().discover()
collects. Nothing here scans the filesystem: the file layout is a
convention, and the source path of every registration (file!()) is carried
into the manifest so the host and the dev UI can point back at it.
Applications use the re-exports from serve, never this crate directly.
use serve_macros::{agent, tool};
assert_eq!(stringify!(agent), "agent");
assert_eq!(stringify!(tool), "tool");Attribute Macros§
- agent
- Register a function returning
serve::Agentas an agent of this app. - channel
- Register a function returning a channel driver (such as
serve::Slackorserve::Webhook) or a configuredserve::Channel. Its inbound webhook is served atPOST /v1/channels/{name}.agent = "…"picks the agent that answers; the default agent otherwise. A companion module with the same name is generated so a schedule can post to the channel:slack::channel("C0123ABC"). - connection
- Register a function whose return value is a connection. Tools read it with
cx.connection::<T>(); aserve::McpServeris also attached to every agent as an MCP server. Credentials stay in the connection, never in the model context. ReturningResult<T>makes a failure a discovery error. - eval
- Register an async function
(t: &mut EvalCx) -> Resultas an eval. Evals run in-process withcargo run -- eval, or against a deployed URL withcargo run -- eval --against <url>. - schedule
- Register an async function
(cx: &Cx) -> Resultto run on a cron schedule. Five-field cron ("0 9 * * MON") is accepted; a six- or seven-field expression with seconds is passed through. - tool
- Register an async function as a tool. The function name is the tool name,
the doc comment is its description, and the remaining parameters become the
tool’s JSON arguments. An optional first parameter
cx: &Cxreceives the per-session context.