Configuration

Both

Single source of truth for all Traccia configuration options and environment variables.

This page documents every configuration option available in Traccia, including config file sections, environment variables, and default values.

Configuration Precedence

Traccia merges configuration from multiple sources. When the same option is set in multiple places, the following priority applies (highest to lowest):

  1. 1
    Explicit parameters — passed to init() or start_tracing()
  2. 2
    Environment variablesTRACCIA_* or AGENT_DASHBOARD_*
  3. 3
    Config file./traccia.toml or ~/.traccia/config.toml
  4. 4
    Defaults — Built-in SDK defaults

Example: If you set TRACCIA_ENDPOINT in your environment and pass endpoint="..." to init(), the explicit parameter wins.

The default endpoint is the Traccia platform (https://api.traccia.ai/v2/traces). Override it only when using a custom OTLP backend.

Platform HTTP/gRPC endpoints

This page documents SDK configuration only. For platform ingestion URLs, gRPC, and third-party OTel client setup, see Platform OTLP Ingestion.

[tracing]

OptionTypeDefaultEnvironment Variables
api_keystringNoneTRACCIA_API_KEY, AGENT_DASHBOARD_API_KEY
endpointstringhttps://api.traccia.ai/v2/traces (Traccia platform)TRACCIA_ENDPOINT, AGENT_DASHBOARD_ENDPOINT
sample_ratefloat1.0TRACCIA_SAMPLE_RATE, AGENT_DASHBOARD_SAMPLE_RATE
auto_start_tracebooltrueTRACCIA_AUTO_START_TRACE, AGENT_DASHBOARD_AUTO_START_TRACE
auto_trace_namestring"root"TRACCIA_AUTO_TRACE_NAME
use_otlpbooltrueTRACCIA_USE_OTLP
service_namestringauto-detectedTRACCIA_SERVICE_NAME
service_rolestring?None

service_name is auto-detected when not set. Python falls back to the script name or working directory. Node.js also checks OTEL_SERVICE_NAME, SERVICE_NAME, and TRACCIA_SERVICE_NAME. Pass service_role programmatically: init(service_role="orchestrator"). Use it for multi-agent host services so the host itself is not registered as an agent in the platform.

[exporters]

OptionTypeDefaultEnvironment Variables
enable_consoleboolfalseTRACCIA_ENABLE_CONSOLE, AGENT_DASHBOARD_ENABLE_CONSOLE_EXPORTER
enable_fileboolfalseTRACCIA_ENABLE_FILE, AGENT_DASHBOARD_ENABLE_FILE_EXPORTER
file_exporter_pathstring"traces.jsonl"TRACCIA_FILE_PATH
reset_trace_fileboolfalseTRACCIA_RESET_TRACE_FILE

Exporter configuration

In traccia.toml, do not enable both enable_console and enable_file. OTLP is controlled separately via use_otlp and can be combined with console or file when initializing programmatically.

[instrumentation]

OptionTypeDefaultEnvironment Variables
enable_patchingbooltrueTRACCIA_ENABLE_PATCHING, AGENT_DASHBOARD_ENABLE_PATCHING
enable_token_countingbooltrueTRACCIA_ENABLE_TOKEN_COUNTING, AGENT_DASHBOARD_ENABLE_TOKEN_COUNTING
enable_costsbooltrueTRACCIA_ENABLE_COSTS, AGENT_DASHBOARD_ENABLE_COSTS
auto_instrument_toolsboolfalseTRACCIA_AUTO_INSTRUMENT_TOOLS
max_tool_spansint100TRACCIA_MAX_TOOL_SPANS
max_span_depthint10TRACCIA_MAX_SPAN_DEPTH
openai_agentsbooltrueTRACCIA_OPENAI_AGENTS
crewaibooltrueTRACCIA_CREWAI

[metrics]

OptionTypeDefaultEnvironment Variables
enable_metricsbooltrueTRACCIA_ENABLE_METRICS
metrics_endpointstringDerived from tracing endpoint ({traces_base}/v2/metrics)TRACCIA_METRICS_ENDPOINT
metrics_sample_ratefloat1.0TRACCIA_METRICS_SAMPLE_RATE

Metrics are emitted even when traces are heavily sampled, so you can keep sample_rate low for traces while keeping metrics_sample_rate at 1.0 for accurate cost and token usage.

[rate_limiting]

OptionTypeDefaultEnvironment Variables
max_spans_per_secondfloat?NoneTRACCIA_MAX_SPANS_PER_SECOND
max_queue_sizeint5000TRACCIA_MAX_QUEUE_SIZE
max_block_msint100TRACCIA_MAX_BLOCK_MS
max_export_batch_sizeint512TRACCIA_MAX_EXPORT_BATCH_SIZE
schedule_delay_millisint5000TRACCIA_SCHEDULE_DELAY_MILLIS

Note: Rate limiting is disabled by default (max_spans_per_second = None). Set a value to enable it.

[runtime]

OptionTypeDefaultEnvironment Variables
session_idstring?NoneTRACCIA_SESSION_ID
user_idstring?NoneTRACCIA_USER_ID
tenant_idstring?NoneTRACCIA_TENANT_ID
project_idstring?NoneTRACCIA_PROJECT_ID
agent_idstring?NoneTRACCIA_AGENT_ID, AGENT_DASHBOARD_AGENT_ID
agent_namestring?NoneTRACCIA_AGENT_NAME
envstring?NoneTRACCIA_ENV

TRACCIA_PROJECT is also supported as a legacy alias for project_id.

[logging]

OptionTypeDefaultEnvironment Variables
debugboolfalseTRACCIA_DEBUG
enable_span_loggingboolfalseTRACCIA_ENABLE_SPAN_LOGGING

[advanced]

OptionTypeDefaultEnvironment Variables
attr_truncation_limitint?NoneTRACCIA_ATTR_TRUNCATION_LIMIT

Special Environment Variables

AGENT_DASHBOARD_PRICING_JSON

Custom pricing table as JSON string. Overrides default model pricing.

bash
export AGENT_DASHBOARD_PRICING_JSON='{
"gpt-4": {"input": 0.03, "output": 0.06},
"gpt-3.5-turbo": {"input": 0.001, "output": 0.002}
}'
AGENT_DASHBOARD_AGENT_CONFIG

Path to agent_config.json file for agent metadata enrichment.

bash
export AGENT_DASHBOARD_AGENT_CONFIG="/path/to/agent_config.json"
OTEL_SERVICE_NAME

Standard OpenTelemetry service name (also supported: SERVICE_NAME).

bash
export OTEL_SERVICE_NAME="my-agent-service"

Example Configurations

Development (Console Output)

traccia.toml
toml
[tracing]
use_otlp = false
[exporters]
enable_console = true
[logging]
debug = true
enable_span_logging = false

Local Jaeger/Tempo

traccia.toml
toml
[tracing]
endpoint = "http://localhost:4318/v1/traces"
use_otlp = true
service_name = "my-agent"
sample_rate = 1.0
[instrumentation]
enable_patching = true
enable_token_counting = true
enable_costs = true

Production (Traccia Platform)

traccia.toml
toml
[tracing]
api_key = "tr_live_xxxxxxxxxxxx"
endpoint = "https://api.traccia.ai/v2/traces"
sample_rate = 0.1
service_name = "production-agent"
[rate_limiting]
max_spans_per_second = 100.0
max_queue_size = 5000
[runtime]
agent_id = "my-agent"
agent_name = "My Agent"
env = "production"
tenant_id = "acme-corp"
project_id = "customer-service"
[logging]
debug = false

Multi-Agent Orchestrator

For a service that hosts many logical agents, use service_role programmatically and scope per-run identity with runtime_config.run_identity():

main.py
python
from traccia import init, runtime_config
init(
api_key="tr_live_xxxxxxxxxxxx",
service_name="my-orchestrator-api",
service_role="orchestrator", # prevents this service being registered as an agent
auto_start_trace=False,
)
with runtime_config.run_identity(agent_id="billing-agent", agent_name="Billing Agent", env="production"):
# all traces/metrics in this block are attributed to billing-agent
...

Governance

Passed to init() / start_tracing(). See Python SDK API (Governance section).

OptionTypeDefaultEnvironment
compliancedictNoneTRACCIA_COMPLIANCE_FRAMEWORKS (comma-separated)
redact_piiboolfalseTRACCIA_REDACT_PII

compliance example: {"frameworks": ["eu_ai_act"], "risk_tier": "high"}. Human review is not an SDK option — use the Governance Hub.

Advanced — runtime policy URLs

Optional [governance] in traccia.toml. Not required for normal use — status and block URLs are derived from your tracing endpoint. See Governance guide.

traccia.toml
toml
[governance]
# Advanced only — omit for standard Traccia deployments
status_check_endpoint = "https://custom.example/agents/{agent_id}/status"
post_block_endpoint = "https://custom.example/agents/{agent_id}/blocks"
status_cache_ttl_seconds = 120

Next Steps

© 2026 Traccia.