← Blog
August 29, 20268 min readSeldon

A reconstructed trace does not identify the program that produced it

Workload identityTrace AuditCompilation

Historical post. This post describes Live Audit, Optimization Cases, Import Audit and signature-compiled routing as they worked in August 2026. Seldon retired those discovery features in October 2026; historical reports remain readable. Seldon now optimizes a request you choose with Functions. The argument below, that trace reconstruction is not enough, still holds.

Reconstructing what an LLM application sent and received is a known engineering problem, and several tools solve it. A reconstructed trace still does not identify the program that produced it, so a cluster of similar traces does not show that a cheaper substitute may serve them. In a sample of 16,397 production observations, Seldon's grouping key put 99.52% of traffic into its five largest groups, so sharing a group said almost nothing about which program produced a trace.

In August 2026, Seldon tried to find repeated LLM tasks in production traffic, such as ticket classification or field extraction, and serve them with cheaper programs. Earlier posts on contract-first clustering and program synthesis treated a cluster of traces as the task to replace. Both methods remain useful for discovery. A sealed measurement on production traffic and seven feasibility spikes showed that neither establishes permission to serve.

The loop we wanted to trust

From captured traffic to a guarded compiled routeCapture complete exchanges at the gateway(or import vendor traces)Count recurring observable contracts, nottopics or sessionsNominate a Candidate pipeline for onecontractQualify it on held-out traces inside anexplicit envelopeRoll out shadow → canary → live, alwaysfail open to the provider

Live Audit grouped traces. An Optimization Case froze one group as a Candidate, meaning a proposed replacement pipeline, and evaluated it. After human-gated steps, the Candidate could be bound for shadow, canary or live serving. Import Audit ran the same discovery on exported Langfuse, LangSmith or Braintrust traces.

All of those steps hung off one key: a digest derived from an LLM's reading of each trace. That key could not carry the load.

Why agent traffic makes this worth doing

Agents multiply both calls and tokens. Vortenza's 2026 breakdown puts simple agents at about five to fifteen LLM calls per task (source). Each call re-sends the system prompt, tool definitions and growing conversation, so input tokens grow roughly with the square of the turn count. Tian Pan reports a five-step climb of 888 → 3,400 → 8,900 → 14,200 → 18,900 tokens (source).

The step worth replacing is usually an inner one, such as invoice-field extraction, while the planning loop keeps its frontier model. Finding that step means recognizing it across sessions and users, which session keys cannot do.

Reconstructing the observation is a known problem

Reconstruction answers one question: given stored evidence, what crossed the instrumented boundary? LangSmith, Langfuse, Helicone, Phoenix, Portkey and OpenAI Traces all address it. It differs from replay, where LangGraph checkpointers re-run an agent's nodes (docs).

The common data model is a session of turn-level traces, each a tree of typed spans.

Session / thread · session_idTurn 1 traceTurn 2 traceTurn 3 traceexpandgeneration · messages → completiontool · name, args_in, result_outgeneration · final assistant textSession groupingLLM generationTool / retrieval span
Fig. A — Session → turn traces → typed spans

Langfuse recommends one trace per chatbot turn and one session per conversation (FAQ). Every reconstruction depends on where capture happens.

Gateway / proxyHelicone · Portkey · Seldon routerPOST /v1/chat/completionsCapture: messages, tools,tool_calls, served responseLocal tool runtime→ result_not_observedNeeds session headers + later role=toolApp SDK tracingLangSmith · Langfuse · Agents SDK@observe / agent_spangeneration_span +function_span (local I/O)retrieval · handoff ·guardrail spansFull turn graph without waiting on HTTP
Fig. B — Gateway capture vs SDK instrumentation

A gateway sees POST /v1/chat/completions. It does not see in-process tools or private retrieval unless their results return as role="tool" messages.

The failures that break audits are ordinary. Record them as statuses instead of repairing them silently.

  • Streaming: storing only a usage stub for a relayed stream leaves it unanalyzable. Assemble fragments before yielding and record complete, stream_error, client_disconnected, partial or truncated.
  • Tools: join tool results by tool_call_id. A proposed call with no result is result_not_observed.
  • Attempts: schema re-asks and provider fallbacks are extra billed calls. Keep them separate from the served response.
  • Session guesses: API key and time adjacency collide under shared service accounts. A missing session header should yield unlinked or inferred, never a silent merge.

Seldon's router implemented this contract, and Import Audit applied it to vendor exports. A compiler needs more.

The observation does not identify the program

Call the task graph that actually ran W, the input X, and the captured prompt and response O. Execution maps W + X → O. Grouping and compilation try to go from O back to W, and that inverse is generally not unique. Different graphs produce the same JSON: field extraction then date normalization, one fused generation step, or in-process validation that leaves no span on the wire.

A classifier can be made repeatable with temperature=0, a fixed seed and structured output. Repeatability does not identify the program. On one invoice-shaped probe, Seldon's signature model alternated between C.key_value_field_extraction alone and that step plus F.date_currency_unit_normalization, a stability of 0.667. Neither answer showed which pipeline ran.

One hash was asked to do three jobs

A compiler needs answers to three different questions about pairs of traces.

Observation O · prompt + responseinverseInferred W · ordered task pipelinev1 digest · one hashStable identityequivalenceSemantic similarityoverlapping rollupReplaceabilitybipartite edgeaccountingdiscoveryserving, after evidenceClassifier interpretationQualification edge
Fig. C — One observation cannot authorize three relations
RelationQuestionAlgebraServe?
Stable identitySame disjoint accounting unit?EquivalenceNo
Semantic similaritySame kind of work, under a named policy?Overlapping, versionedNo
ReplaceabilityMay Candidate X replace the provider for contract A inside envelope V?Bipartite, not transitiveOnly as a passed edge

Replaceability is not transitive. Candidate X may qualify for contracts A and B, and Candidate Y for B and C, while nothing qualifies for both A and C. A cluster built on replaceability would wrongly treat A and C as one program.

The retired system answered all three with one digest:

workload_signature_digest
  = sha256("workload-signature-output-v1" ∥ inferred_pipeline ∥ canonical_output_schema)

The inferred pipeline was an ordered list drawn from 41 task types, produced by a model call. The schema came from the trace's own JSON with values removed. Grouping, Candidate membership, compiled graph structure and serve binding all used this hash. The interface labeled the pipeline model_inferred, but the serving path still treated digest equality as replaceability.

The serve lookup was not a function

Take a support router with one system prompt and an enforced JSON Schema:

user:  order #A-4471 arrived cracked. I paid $59.90
out:   {"intent":"refund_request","order_id":"A-4471","refund_amount":59.90}

user:  order #B-8820 never showed up. refund $12.00
out:   {"intent":"missing_package","order_id":"B-8820","refund_amount":12.00}

Both traces share a masked template, an inferred pipeline and a value-free schema, so they share a digest. A third trace on the same prompt that omits refund_amount has a different schema and a different digest. Optional fields, null values and integer-versus-number types all split groups this way.

At serve time, the router did not re-infer a pipeline. It hashed the incoming masked template and looked up a digest in a map keyed by workspace and template. Because the digest included the observed output schema, one template could point to two digests. The production case was json_schema and json_object requests sharing a masked template. The map marked such rows ambiguous and failed open to the provider, unless exactly one live or canary binding matched the request's output contract. That fallback was a serving patch, not a qualification.

Coarse keys hide identity and fine keys fragment the head

Each identity key is a choice of partition. Seldon measured several keys on a sealed sample: 16,397 readable Live observations from 31 workspaces, July 20 to August 24, 2026. One workspace supplied 97.6% of the sample, so the figures describe this window only. Seldon did not select a key. Perturbation tests showed byte-stability but did not measure accidental merges or paraphrase recall.

Identity armGroupsSingleton rateShare in groups ≥ 3
Masked template13,98093.25%12.65%
Template + declared contract14,01193.32%12.39%
Occurrence-exact observable facts2,58485.53%84.57%
v1 digest (in use then)5964.41%99.63%
Wire-contract facts2917.24%99.95%

The v1 digest, the key in use at the time, produced 59 groups with 99.52% of traffic in the top five. Sharing a digest therefore said almost nothing about identity.

Template plus declared contract was too fragmented. About 12% of observations sat in groups of three or more (Wilson 95% interval 11.90% to 12.91%). A compiler cannot build from singletons.

Occurrence-exact observable facts fell between them. Most groups were singletons, but 84.6% of observations sat in groups of three or more and 72.2% in the top five. That is the shape a compiler wants: a large head of repeated contracts and a tail it can ignore.

What the spikes found

Seldon ran seven read-only feasibility spikes against a pinned window of Live traffic.

  • Typed search: on pinned operator contracts, typing pruned 98.36% to 98.95% of untyped graphs, and bounded search matched exhaustive enumeration. Typed search can propose Candidates, not show which graph ran.
  • Active probes: probes beat passive replay on fixtures in 19 of 20 seeds. They stop at uniqueness, not correctness. An unavailable oracle eliminated nothing, so oracle authority was the binding constraint.
  • Three relations: two independent, blinded machine-annotator sessions labeled 366 pairs. Cohen's kappa, a chance-corrected agreement score, was 0.973 overall: 1.000 for contract, 0.989 for intent and 0.931 for replaceability. These are machine labels, not human agreement. The sample was almost tool-free and had no non-transitive triples, so it tested an easy case.
  • Identity: the identity spike produced partition evidence only. The v1 digest was excluded from selection because it ignores tools and transport, so callers with and without tools could share one binding.
  • Qualification evidence: Candidate lineage showed 8 known fixtures and 79 rows of unknown provenance, which the spikes did not relabel as organic traffic. Tests of the 41-task layer, risk envelopes and edge prediction returned unmeasurable_insufficient_data against named floors.

The missing evidence source was observe-mode dual-run: paired original and Candidate outputs on eligible traffic, with fixture or organic origin recorded at Candidate creation. Without those pairs, serving authority should not have moved.

The split we proposed

The proposed fix separated the jobs the digest combined.

Authority the digest collapsedDeterministic observable-contractfingerprint (accounting)Versioned semantic family + 41-taskinterpretation (discovery only)Candidate graph as a proposal, from typedsearch or templatesQualification edge: contract × Candidate ×envelope → pass | fail | abstainPromote the edge, not the cluster; failopen otherwise

Producer declarations, observations, classifier labels, human judgments and behavioral outcomes would sit in separate, append-only records. The plan included a stop condition. If experts could not label replaceability consistently inside head groups, scope would narrow to curated templates with producer-declared schemas and structured response modes.

Seldon later retired trace-based discovery. Seldon Functions starts from a request the developer chooses and measures alternatives against it.

The general lesson

Any team that caches, routes, distills or compiles from traces must decide whether two traces share a contract or only similar text. Groups built from embeddings or LLM workflow labels are not compile keys.

Capture exchanges completely. Count a contract you can defend. Qualify a Candidate against that contract, and fail open to the provider when you cannot.

Open beta

Route your traffic through Seldon and investigate recurring work that could benefit from a specialized program.

Sign up for open beta →
A reconstructed trace does not identify the program that produced it | Seldon