For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Trust CenterStatusSupportGet a demoPlatform
DocumentationEvals API ReferenceIntegrations & OTELPlatform SettingsSelf-HostingChangelog
DocumentationEvals API ReferenceIntegrations & OTELPlatform SettingsSelf-HostingChangelog
  • Get Started
    • Introduction
    • Setup and Installation
  • LLM Evaluation
    • Introduction
    • Experiments
  • Metrics
    • Introduction
    • Metric Collections
    • Custom Metrics
  • LLM Tracing
    • Introduction
      • Name
      • Tags
      • Metadata
      • Users
    • Signals
    • Troubleshooting
  • Human-in-the-Loop
    • Introduction
    • Collect Feedback
  • Reporting & Analytics
    • Dashboards
    • Executive Insights
  • Red Teaming
    • Introduction
    • Quickstart
    • Frameworks & Policies
    • Risk Profiles
    • Red Team Using DeepTeam
  • Resources
    • Why Confident AI
    • Support
    • Data Handling
    • LLM Use Cases
LogoLogo
Trust CenterStatusSupportGet a demoPlatform
On this page
  • Overview
  • Add Metadata
  • Thread-Level Metadata
LLM TracingCustomize Traces

Metadata

Adding metadata to your traces for additional information
Was this page helpful?
Previous

Users

Tracking user info in your traces for observability
Next
Built with

Overview

With Confident AI, you can attach additional metadata to traces, spans, and threads. This information can be used for filtering, grouping, and analyzing your traces in the observatory.

Add Metadata

Use the update current span and update current trace functions to add span-level and trace-level metadata.

Each metadata argument is a dictionary whose keys are strings and whose values are any JSON-serializable type.

Python
TypeScript
main.py
1from deepeval.tracing import observe, update_current_span, update_current_trace
2
3@observe()
4async def llm_app(query: str):
5 # Add span-level metadata
6 update_current_span(
7 metadata={
8 "source": "knowledge_base_1",
9 "retrieved_documents": 3
10 }
11 )
12
13 # Add trace-level metadata
14 update_current_trace(
15 metadata={
16 "user_id": "user-456",
17 "app_version": "1.2.3",
18 }
19 )
20
21llm_app("Test Metadata")

Thread-Level Metadata

You can also attach metadata to threads — useful for tagging production conversations with attributes like DVA version, client, or agent ID. See Set Thread Metadata for the payload shape.