# Polaris

> Export agent, model and tool activity from an existing Polaris application.

Polaris tracing plugins record agent invocations, model requests and tool calls. Configure the OpenTelemetry plugin in your existing server to export that activity to Radiant Platform.

## Configure export

Enable the `otel` feature on your existing `polaris-ai` dependency, keeping its pinned revision and other enabled features. Get the traces endpoint and ingestion key from [Set up your project](/docs/platform/set-up-your-project.md) and configure the application’s environment:

**Application environment**

```sh
export RADIANT_TRACES_ENDPOINT='https://YOUR_INGESTION_HOST/v1/traces'
export RADIANT_INGESTION_KEY='YOUR_INGESTION_KEY'
export OTEL_SERVICE_NAME='YOUR_APPLICATION_NAME'
```

In the application’s existing server setup, register `ServerInfoPlugin` and `TracingPlugin` if they are not already present. Add the exporter before calling `server.finish().await?`:

**Existing server setup**

```rust
use polaris_ai::plugins::OpenTelemetryPlugin;


server.add_plugins(
    OpenTelemetryPlugin::new(std::env::var("RADIANT_TRACES_ENDPOINT")?)
        .with_service_name(std::env::var("OTEL_SERVICE_NAME")?)
        .with_env_filter("info,polaris=debug")
        .with_export_header(
            "Authorization",
            format!("Bearer {}", std::env::var("RADIANT_INGESTION_KEY")?),
        ),
);
```

This fragment uses the application’s existing `server` inside an async function returning `Result`. Keep the application’s model, tool and session plugins. Call `server.cleanup().await` during shutdown to flush pending spans.

## Capture messages and tool payloads

Content capture is opt-in. To export model messages and tool arguments and results, update your existing `TracingPlugin` registration:

**Existing TracingPlugin registration**

```rust
use polaris_ai::plugins::TracingPlugin;


server.add_plugins(TracingPlugin::default().with_capture_genai_content());
```

Keep any other options configured on that builder. Enable capture only for payloads you intend to export. Recorded messages appear in the model operation’s [Thread tab](/docs/platform/logs/threads.md); tool payloads appear on the corresponding tool operations.

## Add attributes

For deployment context, append a resource attribute to the exporter builder configured earlier:

**Append to the exporter builder**

```rust
.with_resource_attribute("deployment.environment.name", "production")
```

Resource attributes describe the process producing telemetry and apply to its exported spans. They are not per-request values.

Polaris sessions already record the conversation identifier as `gen_ai.conversation.id`. Open [Conversations in Logs](/docs/platform/logs/search-and-filters.md#conversations) to inspect the session’s turns together. To identify agent releases, add `version` to your existing `Agent` implementation:

**Inside the existing Agent implementation**

```rust
fn version(&self) -> Option<&str> {
    Some(env!("CARGO_PKG_VERSION"))
}
```

Session invocations record this value as `gen_ai.agent.version`, which appears in [Agents and versions](/docs/platform/logs/agents-and-versions.md). Here it uses the application’s Cargo package version. See [Telemetry reference](/docs/platform/reference/telemetry.md) for the recognized fields.

## Check the recorded activity

Run a normal agent request and open the project’s **Logs**. Polaris session turns emit agent invocations with agent identity and conversation identifiers; model and tool calls appear beneath the invocation.

Find the invocation in **All agent runs**, or use **All traces** to check the exported operations. See [Runs and traces](/docs/platform/logs/runs-and-traces.md) to inspect them and [Telemetry reference](/docs/platform/reference/telemetry.md#troubleshoot-tracing) if activity is missing.
