Versioning
Track different versions of your application to compare performance and behavior over time.
Why Version Your Traces?
Versioning your traces allows you to:
- Compare performance metrics across different releases
- Track regressions or improvements in LLM responses
- Debug issues by filtering traces to specific versions
- A/B test different prompts or configurations
- Monitor the impact of model upgrades
Setting a Default Version
Set a default version during initialization to automatically tag all traces:
12345678910import tracium # Set version during initializationtracium.init( api_key="sk_live_...", default_version="1.2.3", # Your application version) # All traces now include version="1.2.3"tracium.trace()Note: Use your application's version, not the SDK version. This helps you track changes in your code, not the Tracium SDK.
Version Per Trace
You can also set the version on individual traces, which overrides the default:
123456789101112131415161718import tracium client = tracium.init( api_key="sk_live_...", default_version="1.0.0",) # Override version for a specific tracewith client.agent_trace( agent_name="experiment-bot", version="1.0.0-beta", # Override for this trace) as trace: # This trace uses version "1.0.0-beta" pass # Other traces still use "1.0.0"with client.agent_trace(agent_name="production-bot") as trace: passUsing start_trace()
The start_trace() function also accepts a version parameter:
1234567891011import tracium tracium.init(api_key="sk_live_...") # Start a trace with a specific versionwith tracium.start_trace( agent_name="my-agent", version="2.0.0-rc1",) as trace: # Your code here passVersion from Environment
A common pattern is to read the version from an environment variable or package metadata:
1234567891011121314151617181920212223import traciumimport os # From environment variableversion = os.getenv("APP_VERSION", "dev") tracium.init( api_key="sk_live_...", default_version=version,) # Or from package metadata (Python 3.8+)from importlib.metadata import version as pkg_version try: app_version = pkg_version("your-package-name")except Exception: app_version = "unknown" tracium.init( api_key="sk_live_...", default_version=app_version,)Semantic Versioning
We recommend using semantic versioning (SemVer) for consistency:
# Standard versions
"1.0.0"
"2.1.3"
# Pre-release versions
"1.0.0-alpha"
"1.0.0-beta.1"
"2.0.0-rc.1"
# Development versions
"1.0.0-dev"
"1.0.0+build.123"
# Git-based versions
"1.0.0+abc1234" # Include commit hashBest Practices
Always Set a Version
Even during development, use a version like "dev" or "local" to distinguish development traces from production.
Match Your Release Process
Use the same version string as your deployment/release process. This makes it easy to correlate traces with specific releases.
Include Build Info for CI/CD
In CI/CD environments, consider including the build number or commit hash for precise traceability.