Examples
ReAct CLI agent
Run the public repository’s interactive file assistant with tools and saved sessions.
This example is a complete agent with model calls, file tools, multi-turn history and session persistence. Run it from the public Polaris repository, rather than copying individual modules into your application.
1. Get the matching source
Section titled “1. Get the matching source”You need Git, Rust 1.97.0 or newer and an Anthropic API key. From a directory where you keep projects:
git clone https://github.com/RadiantAILabs/polaris.gitcd polarisgit checkout 5ff84646db63589d58bf87956976d749b8c754derustup override set 1.97.0mkdir -p sandboxAll following commands run from this repository root. The working directory must exist: the CLI canonicalises it at startup.
2. Configure the model
Section titled “2. Configure the model”Set ANTHROPIC_API_KEY using your usual environment or secret manager. The CLI also loads a .env file through dotenvy. Keep secrets out of Git.
The pinned repository example has an older hardcoded model in examples/src/bin/cli.rs. Before running it, change the AgentConfig::new(...) model identifier to anthropic/claude-sonnet-5-5, or another model available to your Anthropic account. There is no --model CLI flag at this pinned revision. The first-agent tutorial shows how to select a model through POLARIS_MODEL instead.
3. Run a session
Section titled “3. Run a session”cargo run -p examples --features polaris/anthropic --bin cli -- ./sandbox --session first-runThe explicit polaris/anthropic feature matters: the example imports AnthropicPlugin, but its Cargo dependency does not enable that provider by default.
At the prompt, try:
What files are in the working directory?Then try:
Create a file named hello.txt containing Hello from Polaris.The agent can call list_files, read_file and write_file. The example requests confirmation for writes. Follow the terminal prompt, then check the file in sandbox/. The filesystem tools constrain paths to this directory; this is an example-specific tool policy, not a general operating-system sandbox.
Continue or revisit a session
Section titled “Continue or revisit a session”| Command | Purpose |
|---|---|
/help |
Show commands |
/history |
Inspect conversation history |
/save |
Persist the current session |
/sessions |
List saved sessions |
/info |
Inspect the current session |
/rollback <turn> |
Restore a conversation checkpoint |
/clear |
Clear conversation history |
/exit |
Leave the CLI |
Sessions are stored under data/ relative to the process working directory. Re-run the same command with --session first-run to resume. A conversation rollback does not undo files written by tools.
Optional trace export
Section titled “Optional trace export”Enable the otel build feature as well as supplying an endpoint:
cargo run -p examples --features polaris/anthropic,otel --bin cli -- ./sandbox \ --session traced-run --otel http://localhost:4318/v1/tracesAdd --capture-content if you want model messages and tool payloads recorded. Without it, content payloads are omitted. The --otel flag alone cannot enable export in a binary compiled without the feature. For a hosted project, follow Radiant Platform setup for the endpoint and authentication configuration.
Troubleshooting
Section titled “Troubleshooting”- No such file or directory: create
sandboxbefore starting. - Unresolved
AnthropicPlugin: use the exact feature flag in the run command above. - Authentication or model-access error: check your key and access to the configured model.
- No trace arrives: enable
otelat build time, confirm the collector is running and inspect exporter errors. - Unexpected earlier history: choose a new
--sessionvalue or inspect the existing session with/history.
Next, walk through the ReAct graph.
Copyright © 2026, Radiant AI Limited.