mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
docs: add data retention and export documentation for AI Bridge (#21055)
Previously AI Bridge retention was only documented in the auto-generated CLI reference, making it difficult for administrators to discover and understand how to configure data retention for compliance requirements. This adds retention configuration to the AI Bridge setup guide with examples, documents the REST API and CLI export options in the monitoring guide, and cross-references AI Bridge from the central data retention page for discoverability. Closes #21038
This commit is contained in:
@@ -35,5 +35,5 @@ AI Bridge is best suited for organizations facing these centralized management a
|
||||
- [Set up AI Bridge](./setup.md) on your Coder deployment
|
||||
- [Configure AI clients](./client-config.md) to use AI Bridge
|
||||
- [Configure MCP servers](./mcp.md) for tool access
|
||||
- [Monitor usage and metrics](./monitoring.md)
|
||||
- [Monitor usage and metrics](./monitoring.md) and [configure data retention](./setup.md#data-retention)
|
||||
- [Reference documentation](./reference.md)
|
||||
|
||||
@@ -9,3 +9,54 @@ AI Bridge records the last `user` prompt, token usage, and every tool invocation
|
||||
We provide an example Grafana dashboard that you can import as a starting point for your metrics. See [the Grafana dashboard README](https://github.com/coder/coder/blob/main/examples/monitoring/dashboards/grafana/aibridge/README.md).
|
||||
|
||||
These logs and metrics can be used to determine usage patterns, track costs, and evaluate tooling adoption.
|
||||
|
||||
## Exporting Data
|
||||
|
||||
AI Bridge interception data can be exported for external analysis, compliance reporting, or integration with log aggregation systems.
|
||||
|
||||
### REST API
|
||||
|
||||
You can retrieve AI Bridge interceptions via the Coder API with filtering and pagination support.
|
||||
|
||||
```sh
|
||||
curl -X GET "https://coder.example.com/api/v2/aibridge/interceptions?q=initiator:me" \
|
||||
-H "Coder-Session-Token: $CODER_SESSION_TOKEN"
|
||||
```
|
||||
|
||||
Available query filters:
|
||||
|
||||
- `initiator` - Filter by user ID or username
|
||||
- `provider` - Filter by AI provider (e.g., `openai`, `anthropic`)
|
||||
- `model` - Filter by model name
|
||||
- `started_after` - Filter interceptions after a timestamp
|
||||
- `started_before` - Filter interceptions before a timestamp
|
||||
|
||||
See the [API documentation](../../reference/api/aibridge.md) for full details.
|
||||
|
||||
### CLI
|
||||
|
||||
Export interceptions as JSON using the CLI:
|
||||
|
||||
```sh
|
||||
coder aibridge interceptions list --initiator me --limit 1000
|
||||
```
|
||||
|
||||
You can filter by time range, provider, model, and user:
|
||||
|
||||
```sh
|
||||
coder aibridge interceptions list \
|
||||
--started-after "2025-01-01T00:00:00Z" \
|
||||
--started-before "2025-02-01T00:00:00Z" \
|
||||
--provider anthropic
|
||||
```
|
||||
|
||||
See `coder aibridge interceptions list --help` for all options.
|
||||
|
||||
## Data Retention
|
||||
|
||||
AI Bridge data is retained for **60 days by default**. Configure the retention
|
||||
period to balance storage costs with your organization's compliance and analysis
|
||||
needs.
|
||||
|
||||
For configuration options and details, see [Data Retention](./setup.md#data-retention)
|
||||
in the AI Bridge setup guide.
|
||||
|
||||
@@ -94,3 +94,26 @@ AI Bridge can relay traffic to other OpenAI- or Anthropic-compatible services or
|
||||
|
||||
> [!NOTE]
|
||||
> See the [Supported APIs](./reference.md#supported-apis) section below for precise endpoint coverage and interception behavior.
|
||||
|
||||
## Data Retention
|
||||
|
||||
AI Bridge records prompts, token usage, and tool invocations for auditing and
|
||||
monitoring purposes. By default, this data is retained for **60 days**.
|
||||
|
||||
Configure retention using `--aibridge-retention` or `CODER_AIBRIDGE_RETENTION`:
|
||||
|
||||
```sh
|
||||
coder server --aibridge-retention=90d
|
||||
```
|
||||
|
||||
Or in YAML:
|
||||
|
||||
```yaml
|
||||
aibridge:
|
||||
retention: 90d
|
||||
```
|
||||
|
||||
Set to `0` to retain data indefinitely.
|
||||
|
||||
For duration formats, how retention works, and best practices, see the
|
||||
[Data Retention](../../admin/setup/data-retention.md) documentation.
|
||||
|
||||
Reference in New Issue
Block a user