Skip to content

Missing Session-Based Tracing API #398

@prajwalun

Description

@prajwalun

Title: Missing session-based tracing API for complex multi-step agent workflows

Description:
I'm building a resume analysis agent that processes entire sessions with multiple sections (skills, education, experience, projects) in sequence. The current tracing API only supports individual function tracing, but I need session-level correlation to track the complete workflow and understand how different sections relate to each other.

Problem:
My agent has a complex workflow where it:

  • Processes multiple sections in sequence
  • Makes decisions at each step (accept/reject/retry)
  • Sometimes pauses for human clarification
  • Maintains session state throughout the process

Currently, I have to manually track session state and correlate traces:

session = {
    "session_id": session_id,
    "created_at": datetime.now().isoformat(),
    "sections": parsed_sections,
    "job_analysis": job_analysis,
    "section_analyses": {},
    "accepted_changes": {},
    "needs_clarification": False,
    "pending_clarifications": {},
    "current_section_index": 0
}

Expected Behavior:
I was hoping for a session-level API that would let me correlate all the spans within a single session, something like:

with judgment.session(session_id="resume_analysis_123") as session:
    session.add_metadata("total_sections", len(sections))
    session.correlate_spans("section_analysis")
    
    # All spans within this context would be correlated
    for section in sections:
        with session.span(f"analyze_{section.type}"):
            # This span would be part of the session
            analyze_section(section)

Current Behavior:
Only individual @judgment.observe() decorators are available, requiring manual session state management and correlation. This makes it difficult to:

  • Track the complete session lifecycle
  • Correlate related spans across different sections
  • Understand session-level metrics and performance
  • Debug issues that span multiple sections

Impact:
Without session-level tracing, I can't effectively monitor and debug complex agent workflows. This is particularly important for production systems where understanding the complete user journey is crucial.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions