Skip to content
Radiant LabsRadiant Labs

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.

You need Git, Rust 1.97.0 or newer and an Anthropic API key. From a directory where you keep projects:

Terminal window
git clone https://github.com/RadiantAILabs/polaris.git
cd polaris
git checkout 5ff84646db63589d58bf87956976d749b8c754de
rustup override set 1.97.0
mkdir -p sandbox

All following commands run from this repository root. The working directory must exist: the CLI canonicalises it at startup.

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.

Terminal window
cargo run -p examples --features polaris/anthropic --bin cli -- ./sandbox --session first-run

The 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.

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.

Enable the otel build feature as well as supplying an endpoint:

Terminal window
cargo run -p examples --features polaris/anthropic,otel --bin cli -- ./sandbox \
--session traced-run --otel http://localhost:4318/v1/traces

Add --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.

  • No such file or directory: create sandbox before 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 otel at build time, confirm the collector is running and inspect exporter errors.
  • Unexpected earlier history: choose a new --session value or inspect the existing session with /history.

Next, walk through the ReAct graph.