---
title: "Discussion on \"Tracing the Agent\" | Hashnode"
description: "Discussion on \"Tracing the Agent\". Fifth post in the \"AI Product Engineering\" series. Repo: github.com/i-adnanali/dairy-agent."
url: "https://hashnode.com/posts/tracing-the-agent/6a5718bf5650dcbff1cd9264"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Tracing the Agent](https://i-adnanali.hashnode.dev/tracing-the-agent?utm_source=hashnode&utm_medium=feed)

Fifth post in the "AI Product Engineering" series. Repo: github.com/i-adnanali/dairy-agent.

Jul 15 · 6 min read · i-adnanali.hashnode.dev  
Read the article

-   [#ai-agents](https://hashnode.com/tag/ai-agents)
-   [#opentelemetry](https://hashnode.com/tag/opentelemetry)
-   [#observability](https://hashnode.com/tag/observability)
-   [#llm](https://hashnode.com/tag/llm)
-   [#typescript](https://hashnode.com/tag/typescript)
-   [#angular](https://hashnode.com/tag/angular)

## Written by

[Adnan Ali](https://hashnode.com/@i-adnanali)

@i-adnanali · Lahore, Pakistan

  
[View profile](https://hashnode.com/@i-adnanali)

Product engineer building AI into enterprise products. Build logs.

Product engineer building AI into enterprise products. Contracted to Facelift since 2019: I built the AI chat assistant in its Analyze product, and I'm building its successor in FDS (Facelift Data Studio). On the side I build dairy-agent, an open-source farm management agent for the dairy I run (Angular, AG-UI, self-hosted Langfuse/OTel). I write about what happens when you put an LLM behind a real UI: the protocol decisions, the failure modes, the observability you didn't know you'd need. No tutorials, just build logs.

## Responses 2

Markdown supported · ⌘↵ to post

[Kartik N V J K](https://hashnode.com/@kartik-nvj)

[Jul 16](https://hashnode.com/posts/tracing-the-agent/6a5718bf5650dcbff1cd9264/comment/6a58e061d1256ec93b52efa8)

Keeping instrumentation one level below the AG-UI event stream, so a third transport inherits tracing for free, is a clean call. I have hit the same approval-boundary issue where a pause and its resume split into two disconnected traces, and stable session keying is the only thing that makes latency there measurable. Are you capturing human wait time separately from model latency in that session?

[Adnan Ali](https://hashnode.com/@i-adnanali)

[Jul 17](https://hashnode.com/posts/tracing-the-agent/6a5718bf5650dcbff1cd9264/comment/6a58e061d1256ec93b52efa8#reply-6a59af9c5861bc3593c864b5)

Good catch - not captured as its own metric today. Here's what I found checking it, rather than assuming:

**The two traces** (same session, keyed on `threadId`):

trace 9dbc5698… (awaiting\_approval) start: 08:43:52.010 latency: 2.63s → ends (card appears): ~08:43:54.64

trace c7b8378c… (resume) start: 08:44:10.000

**First pass:** diff the two trace timestamps directly → 17.99s ≈ 18s. That's what I almost replied with.

**Problem:** that folds in the 2.63s of model latency from the awaiting\_approval trace itself - the exact thing your question is getting at.

**Corrected:** using the trace's end (start + latency) instead of its start: 08:44:10.000 − 08:43:54.64 ≈ **15.4s** — that's the actual human decision time.

Not wired up as a derived metric yet, but fully recoverable from data Langfuse already has - threadId gets you the session, start+latency on each trace gets you the boundary. Computing this automatically per session and attaching it as a score would be the natural next step, same pattern as the finish\_reason metadata.

I hope this checks out.
