Skip to main content

Crate agent_trace_contract

Crate agent_trace_contract 

Source
Expand description

HTTP API contract for the Trace Infra service.

§Why trace is its own service and not part of History Infra

Conversation messages and trace events look similar on the wire and behave nothing alike:

ConversationTrace
Replayed into a model promptyesnever
Losing one recordloses user workacceptable
Volumeone per turnmany per turn
Retentiondurableshort

Sharing one store would force the stricter guarantee onto high-volume diagnostic data, and — worse — put events one filtering mistake away from being replayed as conversation. Separate services keep that impossible by construction.

§Layering

agent-trace-contract   paths + DTOs + redaction   (this crate)
agent-trace-runtime    store implementation
agent-trace-server     router + auth + bin

See api.md for the full HTTP reference.

Structs§

ActivityPoint
Activity data point (daily).
ActivityResponse
Activity response grouped by project.
ApiError
Error body shared by every non-2xx response.
AppendEventsRequest
AppendResponse
Result of an append. skipped counts ids that already existed, so a caller can tell a fresh write from a deduplicated retry.
CacheHitRatePoint
Cache hit rate data point.
CacheHitRateResponse
Cache hit rate response (flat list).
ClickHouseAdminConfig
Redacted platform ClickHouse connection. Secrets are never serialized.
CostBreakdownPoint
Cost breakdown data point (input/output/total).
CostBreakdownResponse
Cost breakdown response (flat list).
CreateLangfuseProjectRequest
Allocate a Langfuse project and project-level API key to Infra resources.
ErrorRatePoint
A single error-rate data point (daily bucket).
ErrorRateResponse
Error rate response grouped by project.
EventsResponse
Events in chronological order, oldest first.
InitializeRuntimeBindingRequest
LangfuseAdminConfig
Redacted platform Langfuse organization credentials. Secrets are never serialized.
LangfuseProject
Persisted Langfuse project assignment. Project secrets are intentionally absent from lookup/list responses.
LangfuseProjectPage
LatencyPoint
A single latency data point (daily bucket).
LatencyResponse
Latency response grouped by project.
ListLangfuseProjectsRequest
Query the project-to-resource relationships maintained by Trace Infra.
MetricsQuery
Request body for all metrics queries.
ModelBreakdownEntry
A single model breakdown row.
ModelTrendPoint
Model usage trend point (daily).
ModelTrendResponse
Model trend response grouped by project.
PricingTierPoint
Pricing tier analysis data point.
PricingTierResponse
Pricing tier response (flat list).
ProjectSummary
Project-level summary stats.
ProvisionedLangfuseProject
Creation response. The secret can be recovered only through an idempotent replay of the same create request; ordinary project queries redact it.
RuntimeEventRecord
One runtime trace event.
RuntimeLangfuseBinding
SearchEventsRequest
TokenDistributionPoint
Token distribution statistics (by model).
TokenDistributionResponse
Token distribution response (flat list).
TokenUsagePoint
A single data point in a token-usage timeseries.
TokenUsageResponse
Top-level response for the token-usage timeseries endpoint.
TraceScope
Identifies what a trace event belongs to.
UpdateClickHouseAdminConfigRequest
UpdateLangfuseAdminConfigRequest

Enums§

MetricsDataSource
Which ClickHouse table to query.

Constants§

ADMIN_CLICKHOUSE_CONFIG_PATH
ADMIN_GATEWAY_CLICKHOUSE_CONFIG_PATH
ADMIN_GATEWAY_LANGFUSE_CONFIG_PATH
ADMIN_LANGFUSE_CONFIG_PATH
ADMIN_LANGFUSE_PROJECTS_PATH
AUDIENCE
DEFAULT_PAGE_SIZE
Default page size when a request omits limit.
DEFAULT_PORT
EVENTS_APPEND_PATH
EVENTS_SEARCH_PATH
HEALTH_PATH
LANGFUSE_PROJECTS_PATH
LANGFUSE_PROJECT_PATH
MAX_LANGFUSE_PROJECT_PAGE_SIZE
MAX_METRICS_LOOKBACK_DAYS
MAX_PAGE_SIZE
Upper bound the server enforces on any page size.
METRICS_ACTIVITY_PATH
METRICS_CACHE_HIT_RATE_PATH
METRICS_COST_BREAKDOWN_PATH
METRICS_ERROR_RATE_PATH
METRICS_LATENCY_PATH
METRICS_MODEL_BREAKDOWN_PATH
METRICS_MODEL_TREND_PATH
METRICS_PRICING_TIER_PATH
METRICS_PROJECT_SUMMARY_PATH
METRICS_TOKEN_DISTRIBUTION_PATH
METRICS_TOKEN_USAGE_PATH
REDACTED
Placeholder written over any value that looks like a credential.
RUNTIME_BINDING_INITIALIZE_PATH
RUNTIME_BINDING_PATH
SERVICE_NAME
SERVICE_TOKEN_ENV
Optional static service token. When unset, the server runs in open mode.

Functions§

redact_payload
Mask credential-shaped fields anywhere in a trace payload.