{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "rohitg00-ai-engineering-from-scratch--debug-agent-trace-timing-and-tokens",
 "repo": "rohitg00/ai-engineering-from-scratch",
 "repo_url": "https://github.com/rohitg00/ai-engineering-from-scratch",
 "repo_slug": "rohitg00-ai-engineering-from-scratch",
 "title": "Separate child work from parent time in an agent trace",
 "page_title": "How to separate child work from parent time in an agent trace with AI Engineering From Scratch",
 "summary": "Parse a JSONL agent trace, fix overlapping span timing, and output an HTML timeline and regression report.",
 "who": "A developer debugging a multi-step agent whose latency and token totals changed after an update.",
 "problem": "Overlapping child spans make parent execution time and token usage look larger than the work actually done.",
 "outcome": "An input trace, an HTML timeline, and a JSON regression report that keep per-span token counts exclusive.",
 "steps": [
  "Run `node --version` and confirm it reports 22.18 or newer. (inferred, check the README)",
  "Run `python3 scripts/project_test.py agent-trace-debugger --init learning-artifacts/agent-trace-debugger` from the repository root. (inferred, check the README)",
  "Implement JSONL parsing, parent validation, and interval arithmetic in the starter.",
  "Run `python3 scripts/project_test.py agent-trace-debugger --all --path learning-artifacts/agent-trace-debugger --strict` until every stage passes. (inferred, check the README)",
  "Keep the input trace, the HTML timeline, and the JSON regression report from the output folder."
 ],
 "agent_prompt": "In the repo rohitg00/ai-engineering-from-scratch, run the agent-trace-debugger project with --init into learning-artifacts/agent-trace-debugger, then implement the stages until the --all --strict grader passes. Expected output: an HTML timeline and a JSON regression report for the supplied trace. Verify that per-span token counts are not double counted between parent and child spans.",
 "agents": [
  "any"
 ],
 "difficulty": "Advanced",
 "time": "45 minutes",
 "basis": "readme",
 "caveat": "The project uses Node.js for the debugger and Python 3 for the grader, so both runtimes must be installed.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "Node.js, npx, and python3 installed for the coding agent tutor",
  "A skill-capable coding agent such as Claude Code or Codex, with a writable skills scope",
  "Python 3.10 or newer for the retrieval and firewall projects",
  "Node.js 22.18 or newer for the agent trace debugger",
  "A clone of the repository so the project_test.py grader is available"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.8,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/rohitg00-ai-engineering-from-scratch/debug-agent-trace-timing-and-tokens/",
 "md": "https://dedupedai.com/use-cases/rohitg00-ai-engineering-from-scratch/debug-agent-trace-timing-and-tokens/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/rohitg00-ai-engineering-from-scratch--debug-agent-trace-timing-and-tokens.json",
 "api_version": "v1"
}
