# ai_agent

Reports which AI coding agent, if any, is running the process.

Every request sends an [`AI_AGENT_HEADER`](https://dev.nominal.io/nominal-streaming/ref/rust/nominal_streaming/ai_agent.md#constant.AI_AGENT_HEADER "nominal_streaming::ai_agent::AI_AGENT_HEADER") header naming the agent, or `none` when no agent
marks the process, so Nominal can tell agent-driven use apart from other use and from releases
that never checked. Detection matches the Nominal Python client.

## Functions

### pub fn detect_ai_agent() -> Option<String>

The name of the AI coding agent running this process, or `None` when there is none.

`AI_AGENT` wins and names the agent; a false value such as `0` opts out. Otherwise a known
agent’s own variable, then a generic `AGENT`, mark the process (`AGENT=1` gives `unknown`).

### pub fn ai_agent_header_value() -> HeaderValue

The [`AI_AGENT_HEADER`](https://dev.nominal.io/nominal-streaming/ref/rust/nominal_streaming/ai_agent.md#constant.AI_AGENT_HEADER "nominal_streaming::ai_agent::AI_AGENT_HEADER") value: the detected agent reduced to a single bounded token, or
[`NO_AI_AGENT`](https://dev.nominal.io/nominal-streaming/ref/rust/nominal_streaming/ai_agent.md#constant.NO_AI_AGENT "nominal_streaming::ai_agent::NO_AI_AGENT").

## Constants

### pub const AI_AGENT_HEADER: &str = "x-nominal-ai-agent"

Request header carrying the detected AI coding agent, or [`NO_AI_AGENT`](https://dev.nominal.io/nominal-streaming/ref/rust/nominal_streaming/ai_agent.md#constant.NO_AI_AGENT "nominal_streaming::ai_agent::NO_AI_AGENT").

### pub const NO_AI_AGENT: &str = "none"

[`AI_AGENT_HEADER`](https://dev.nominal.io/nominal-streaming/ref/rust/nominal_streaming/ai_agent.md#constant.AI_AGENT_HEADER "nominal_streaming::ai_agent::AI_AGENT_HEADER") value when no agent marks the process.
