From 69ed633ac4a9e34cb87ed9a0c44238cce8c0c0d9 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Wed, 30 Sep 2026 00:40:11 -0700 Subject: [PATCH] feat(ui): add agent trace API calls --- .../src/components/networking.tsx | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/ui/litellm-dashboard/src/components/networking.tsx b/ui/litellm-dashboard/src/components/networking.tsx index 42dc5350b49..d0a5349364f 100644 --- a/ui/litellm-dashboard/src/components/networking.tsx +++ b/ui/litellm-dashboard/src/components/networking.tsx @@ -115,6 +115,7 @@ import type { ComplexityRouterConfigPayload } from "./add_model/build_complexity import type { AutoRouterPresetsResponse } from "@/lib/autorouter_presets"; import type { VectorStoreIndex } from "@/app/(dashboard)/vector-stores/_components/IndexesTab"; import type { RoutingDecision } from "./view_logs/LogDetailsDrawer/RoutingDecisionCard"; +import type { SpanDetail, Trace, TracePage } from "./view_logs/TraceView/traceTypes"; import { createApiClient, deriveErrorMessage, @@ -2101,6 +2102,33 @@ export const uiSpendLogsCall = async ({ } }; +/** + * Agent tracing. All three respond 501 `{detail}` when `general_settings.tracing` is not + * configured; callers can detect that through the thrown `ApiError`'s `status`. + */ +export const agentTraceListCall = async ({ + accessToken, + startMs, + endMs, + cursor, +}: { + accessToken: string; + startMs: number; + endMs: number; + cursor?: string | null; +}): Promise => { + const query = { start_ms: startMs, end_ms: endMs, cursor: cursor ?? undefined }; + return apiClient.get(`/v1/traces`, { accessToken, query }); +}; + +export const agentTraceCall = async (accessToken: string, traceId: string): Promise => + apiClient.get(`/v1/traces/${encodeURIComponent(traceId)}`, { accessToken }); + +export const agentTraceSpanCall = async (accessToken: string, traceId: string, spanId: string): Promise => + apiClient.get(`/v1/traces/${encodeURIComponent(traceId)}/spans/${encodeURIComponent(spanId)}`, { + accessToken, + }); + export const adminSpendLogsCall = async (accessToken: string) => { try { const data = await apiClient.get(`/global/spend/logs`, { accessToken });