pub fn track<H: ServerHandler>(
handler: H,
project_id: impl Into<String>,
options: Options,
) -> Tracked<H>Expand description
Wraps handler with a new AgentCat handle for project_id: the one-line setup for a
server with one handler, such as a stdio server. The handle is AgentCat::new’s, so
AGENTCAT_ENABLED turns it off in the same way.
The returned server holds the only clone of the handle, so its drop drains the events and can
block the dropping thread for up to 5 s: see dropping the last
handle. On a current-thread runtime, clone the handle with
Tracked::agentcat before you serve, and call its shutdown before
the runtime ends.
use agentcat_sdk::{Options, track};
use rmcp::ServiceExt;
let server = track(MyServer, "proj_123", Options::default());
let running = server.serve(transport).await?;
running.waiting().await?;