A Coding Implementation to Parsing, Analyzing, Visualizing, and Fine-Tuning Agent Reasoning Traces Using the lambda/hermes-agent-reasoning-traces Dataset

The story

In this tutorial, we explore the lambda/hermes-agent-reasoning-traces dataset to understand how agent-based models think, use tools, and generate responses across multi-turn conversations. We start by loading and inspecting the dataset, examining its structure, categories, and conversational format to get a clear idea of the available information. We then build simple parsers to extract key compon
From the source
News Hub @media (max-width:767px){.tdi_8{margin-left:auto!important}} .tdb_mobile_search{margin-bottom:0;clear:none}.tdb_mobile_search a{display:inline-block!important;position:relative;text-align:center;color:var(--td_theme_color,#4db2ec)}.tdb_mobile_search a>span{display:flex;align-items:center;justify-content:center}.tdb_mobile_search svg{height:auto}.tdb_mobile_search svg,.tdb_mobile_search svg *{fill:var(--td_theme_color,#4db2ec)}#tdc-live-iframe .tdb_mobile_search a{pointer-events:none}.td-search-opened{overflow:hidden}.td-search-opened #td-outer-wrap{position:static}.td-search-opened .td-search-wrap-mob{position:fixed;height:calc(100% + 1px)}.td-search-opened .td-drop-down-search{height:calc(100% + 1px);overflow-y:scroll;overflow-x:hidden}.tdi_8{display:inline-block}.tdi_8 .tdb-head
!pip -q install -U datasets pandas matplotlib seaborn transformers accelerate trl import json, re, random, textwrap from collections import Counter, defaultdict import pandas as pd import numpy as np import matplotlib.pyplot as plt from datasets import load_dataset, concatenate_datasets random.seed(0) CONFIG = "kimi" ds = load_dataset("lambda/hermes-agent-reasoning-traces", CONFIG, split="train") print(ds) print("Config:", CONFIG, "| Fields:", ds.column_names) print("Categories:", sorted(set(ds["category"]))) COMPARE_BOTH = False if COMPARE_BOTH: ds_kimi = load_dataset("lambda/hermes-agent-reasoning-traces", "kimi", split="train") ds_glm = load_dataset("lambda/hermes-agent-reasoning-traces", "glm-5.1", split="train") ds_kimi = ds_kimi.add_column("source", ["kimi"] * len(ds_kimi)) ds_glm =
THINK_RE = re.compile(r" (.?) ", re.DOTALL) TOOL_CALL_RE = re.compile(r" \s(\{.?\})\s ", re.DOTALL) TOOL_RESP_RE = re.compile(r" \s(.?)\s* ", re.DOTALL) def parse_assistant(value: str) -> dict: thoughts = [t.strip() for t in THINK_RE.findall(value)] calls = [] for raw in TOOL_CALL_RE.findall(value): try: calls.append(json.loads(raw)) except json.JSONDecodeError: calls.append({"name": " ", "arguments": {}}) final = TOOL_CALL_RE.sub("", THINK_RE.sub("", value)).strip() return {"thoughts": thoughts, "tool_calls": calls, "final": final} def parse_tool(value: str): raw = TOOL_RESP_RE.search(value) if not raw: return {"raw": value} body = raw.group(1) try: return json.loads(body) except: return {"raw": body} first_gpt = next(t for t in sample["conversations"] if t["from"] == "gpt") p = par
Who and what
Key names and topics in this story: Coding Implementation, Parsing, Analyzing, Visualizing.
Where to follow next
- Read the full piece at www.marktechpost.com
- More from our AI & prompts coverage

Related stories

Study: AI models that consider user s feeling are more likely to make errors
Overtuning can cause models to "prioritize user satisfaction over truthfulness.”

The best AI dictation apps, tested and ranked
AI-powered dictation apps are useful for replying to emails, taking notes, and even coding through your voice

Mistral AI Launches Remote Agents in Vibe and Mistral Medium 3.5 with 77.6% SWE-Bench Verified Score
Mistral AI's latest release brings async cloud-based coding sessions, a new 128B flagship model, and an agentic Work mode to Le Chat — a meaningful step forward for developers building with AI agents. The post Mistral AI Launches Remote Agents in Vibe and Mistral Medium 3.5 with

Musk v. Altman is just getting started
Elon Musk spent the better part of three days on the witness stand this week in his lawsuit against OpenAI, and it s already getting messy. Emails, texts, and his own tweets are surfacing in court, and there are plenty more witnesses to come. Musk s argument against OpenAI? By co