Rust Quick Start
This quick start shows the smallest Rust workflow that emits scope, tool, and LLM events.
Choose an Install Path
Pick the installation path that matches whether you are using a published package or a local checkout.
Install from a Package Manager
Use the published crates when you are consuming a release:
Install the published NeMo Relay CLI separately when you need coding-agent hook and LLM gateway observability:
Install from the Repository
Use a path dependency when your application is consuming a local checkout:
nemo-relayis the core Rust runtime surface.tokioprovides the async runtime used by the managed tool and LLM helpers in this quick start.nemo-relay-adaptiveis a companion crate for adaptive runtime primitives and Redis-backed learning components when you need adaptive behavior later, but it is not required for this minimal direct-runtime example.nemo-relay-cliis a binary crate. Usecargo install nemo-relay-cli@0.5.0when you need the NeMo Relay CLI.
Run One Scope, One Tool Call, and One LLM Call
The example below creates a scope, records an initialization mark, runs one
managed tool call, and runs one managed LLM call through the public Rust APIs.
Place it in src/main.rs in the same Cargo project where you added the
dependencies above, then run cargo run.
What Success Looks Like
You should see:
- Event lines for the root scope, managed tool and LLM lifecycles, plus the
initializedmark event {"echo":"hello"}from the tool call- A final object containing
ok: trueand the echoed message payload from the LLM callback
Native subscriber delivery is asynchronous, so flush before checking subscriber output. If you only see the returned JSON values and no event lines, the tool and LLM callbacks ran but you did not verify instrumentation.
That tells you two things:
- The direct Rust runtime APIs ran successfully.
- Emitted events were observable through the subscriber system.
What to Learn Next
Use these links to continue from the quick start into the core runtime concepts.
- Use Scopes, Middleware, Subscribers, and Plugins for the runtime model.