Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
N
nocode-gpu-stack
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • agently
  • nocode-gpu-stack
  • Merge requests
  • !1

Merged
Created Jun 28, 2026 by agently@agentlyMaintainer

feat(litellm): per-request Langfuse routing + trace linking; retrofit prod state

  • Overview 0
  • Commits 3
  • Changes 6

What

Adds a LiteLLM proxy custom callback that consolidates agently's two trace streams into one, and retrofits this role to match the running prod box.

Callback (files/custom_callbacks.py)

Reads hyphenated x-agent-langfuse-* request headers and, per request:

  • routes LiteLLM's Langfuse logging to the instance named by the headers (patches the per-request logging object's standard_callback_dynamic_params — must be the logging object, since dynamic creds are resolved before the pre-call hook runs);
  • links the GENERATION to the agently OTel trace via x-agent-langfuse-trace-id → metadata["existing_trace_id"].

Hyphenated names sidestep LiteLLM's stock langfuse_ (underscore) parser and nginx's default underscore-dropping — no nginx change needed. Fails open.

Retrofit (group_vars + templates)

The repo still described the old Ollama setup; prod has moved to vLLM from /opt/litellm via a start.sh wrapper. Reconciled the role (config path, models, service unit, start.sh, debug logging, anthropic-messages passthrough) so site.yml reproduces — rather than clobbers — the live deployment. Rendered output diff-checked against the live /opt/litellm files.

Status

Already applied live on nocode and verified end-to-end (routing to the correct instance + GENERATION attaches to the trace; fail-open fallback confirmed). This MR captures that state as code.

🤖 Generated with Claude Code

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: agent/litellm-langfuse-routing-e137