Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Confident ai Deepeval Update Current Trace

From Leeroopedia

Overview

Update Current Trace is the implementation function that enriches the currently active trace with metadata for filtering, grouping, and analysis in the Confident AI dashboard. It allows developers to inject contextual information -- such as trace names, tags, user identifiers, and custom metadata -- into traces from within any observed function.

API Documentation

Function: update_current_trace

Source: deepeval/tracing/context.py:L62-118

Import:

from deepeval.tracing import update_current_trace

Signature:

update_current_trace(
    name=None,
    tags=None,
    metadata=None,
    thread_id=None,
    user_id=None,
    input=None,
    output=None,
    test_case=None,
    confident_api_key=None,
    test_case_id=None,
)

Parameters

Parameter Type Description
name Optional[str] A human-readable name for the trace (e.g., "customer-support-agent").
tags Optional[List[str]] A list of string tags for categorization and filtering (e.g., ["production", "v2"]).
metadata Optional[Dict] Arbitrary key-value pairs for custom contextual data (e.g., {"model_version": "gpt-4o"}).
thread_id Optional[str] Identifier for the conversation thread, enabling multi-turn conversation tracking.
user_id Optional[str] Identifier for the user who triggered the trace.
input Optional Override the automatically captured trace input.
output Optional Override the automatically captured trace output.
test_case Optional Associate a test case with the trace.
confident_api_key Optional[str] Override the default Confident AI API key for this trace.
test_case_id Optional[str] Associate a specific test case ID with the trace.

Input / Output

  • Inputs: Metadata values (name, tags, metadata dict, thread_id, user_id, and optional overrides).
  • Outputs: The active trace is enriched with the provided metadata, which appears in the Confident AI dashboard for filtering and analysis.

Usage Example

from deepeval.tracing import observe, update_current_trace

@observe(type="agent")
def my_agent(query: str) -> str:
    update_current_trace(
        name="customer-support-agent",
        tags=["production", "v2"],
        metadata={"model_version": "gpt-4o"},
        thread_id="conv-123",
        user_id="user-456",
    )
    return process(query)

Relationships

Principle:Confident_ai_Deepeval_Trace_Metadata_Enrichment

Metadata

DeepEval Tracing Observability LLM_Evaluation 2026-02-14 09:00 GMT

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment