mukunda1729 commited on
Commit
5c49f9c
·
verified ·
1 Parent(s): 83d94ff

Initial: agentsnap trace JSON schema reference

Browse files
Files changed (2) hide show
  1. README.md +12 -5
  2. index.html +76 -17
README.md CHANGED
@@ -1,10 +1,17 @@
1
  ---
2
- title: Trace Format Reference
3
- emoji: 📚
4
- colorFrom: purple
5
- colorTo: gray
6
  sdk: static
7
  pinned: false
 
 
 
 
 
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Agent Trace Format Reference
3
+ emoji: 📸
4
+ colorFrom: green
5
+ colorTo: indigo
6
  sdk: static
7
  pinned: false
8
+ license: mit
9
+ short_description: "The agentsnap trace schema — explained field-by-field."
10
+ tags:
11
+ - llm
12
+ - agents
13
+ - traces
14
+ - agentsnap
15
  ---
16
 
17
+ Field-by-field reference for the agentsnap trace JSON schema.
index.html CHANGED
@@ -1,19 +1,78 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
  <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Agent Trace Format Reference</title>
7
+ <style>
8
+ :root { --bg: #1a1a1a; --fg: #e8e6e1; --muted: #9a9690; --accent: #d4a853; --card: #232323; --border: #353535; }
9
+ * { box-sizing: border-box; }
10
+ body { font: 16px/1.55 -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif; background: var(--bg); color: var(--fg); margin: 0; padding: 2rem 1.25rem; }
11
+ main { max-width: 920px; margin: 0 auto; }
12
+ h1 { color: var(--accent); font-size: 2.1rem; margin: 0 0 0.5rem; }
13
+ h2 { color: var(--accent); font-size: 1.3rem; margin: 2rem 0 0.6rem; }
14
+ .lede { color: var(--muted); font-size: 1.05rem; }
15
+ pre { background: var(--card); border: 1px solid var(--border); padding: 1rem 1.1rem; border-radius: 8px; overflow-x: auto; font-family: ui-monospace, SF Mono, monospace; font-size: 0.85rem; line-height: 1.5; }
16
+ table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
17
+ th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; vertical-align: top; }
18
+ th { color: var(--accent); }
19
+ td code { color: var(--accent); font-family: ui-monospace, SF Mono, monospace; }
20
+ td.field { white-space: nowrap; }
21
+ a { color: var(--accent); }
22
+ footer { color: var(--muted); margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); font-size: 0.9rem; }
23
+ </style>
24
+ </head>
25
+ <body>
26
+ <main>
27
+ <h1>📸 Agent Trace Format</h1>
28
+ <p class="lede">A normalized JSON shape for capturing one agent run — input, tool calls, output, and a fingerprint. Used by <code>agentsnap</code> to diff runs and detect silent regressions.</p>
29
+
30
+ <h2>Full example</h2>
31
+ <pre>{
32
+ "version": 1,
33
+ "model": "claude-sonnet-4-6",
34
+ "input": "search for python tutorials",
35
+ "output": "Here are 3 results.",
36
+ "tools": [
37
+ { "name": "web_search", "args": { "q": "python tutorials" }, "result_hash": "abc123" },
38
+ { "name": "fetch_page", "args": { "url": "https://example.com" }, "result_hash": "def456" }
39
+ ],
40
+ "error": null,
41
+ "fingerprint": { "node": "20.0", "agentsnap": "0.1.0" }
42
+ }</pre>
43
+
44
+ <h2>Fields</h2>
45
+ <table>
46
+ <tr><th>Field</th><th>Type</th><th>Notes</th></tr>
47
+ <tr><td class="field"><code>version</code></td><td>int</td><td>Schema version. Currently <code>1</code>.</td></tr>
48
+ <tr><td class="field"><code>model</code></td><td>string</td><td>Model identifier. Used to skip diffs across model upgrades.</td></tr>
49
+ <tr><td class="field"><code>input</code></td><td>string</td><td>The user prompt that started the run.</td></tr>
50
+ <tr><td class="field"><code>output</code></td><td>string</td><td>Final agent response.</td></tr>
51
+ <tr><td class="field"><code>tools</code></td><td>array</td><td>Ordered list of tool calls. Each entry is <code>{name, args, result_hash}</code>.</td></tr>
52
+ <tr><td class="field"><code>tools[].name</code></td><td>string</td><td>Tool identifier (dotted path like <code>filesystem.read_file</code>).</td></tr>
53
+ <tr><td class="field"><code>tools[].args</code></td><td>object</td><td>Args passed to the tool. Recorded literally.</td></tr>
54
+ <tr><td class="field"><code>tools[].result_hash</code></td><td>string</td><td>Hash of the tool's return value. Avoid storing PII / large payloads in the trace.</td></tr>
55
+ <tr><td class="field"><code>error</code></td><td>string \| null</td><td>Run-level error message, if the run failed.</td></tr>
56
+ <tr><td class="field"><code>fingerprint</code></td><td>object</td><td>Environment metadata. <code>node</code> + <code>agentsnap</code> version are recommended; add your own keys.</td></tr>
57
+ </table>
58
+
59
+ <h2>Why hash the tool result?</h2>
60
+ <p>Tool results are often large (files, API payloads, search results). Hashing keeps the trace small and avoids leaking PII into your snapshot store. The hash is enough to detect "the result changed" — for "<em>how</em> did it change?", re-run with full payloads enabled.</p>
61
+
62
+ <h2>Diffing two traces</h2>
63
+ <pre>from agentsnap import diff
64
+
65
+ result = diff(baseline_trace, current_trace)
66
+ print(result.status) # "match" | "drift" | "regression"
67
+ for change in result.changes:
68
+ print(change.path, change.from_, "→", change.to)</pre>
69
+
70
+ <h2>Sample traces</h2>
71
+ <p>The <a href="https://huggingface.co/datasets/mukunda1729/agent-trace-samples">agent-trace-samples</a> dataset has 10 example traces (good + regressed pairs) you can drop into your tests.</p>
72
+
73
+ <footer>
74
+ Part of <a href="https://mukundakatta.github.io/agent-stack/">The Agent Reliability Stack</a> · MIT licensed
75
+ </footer>
76
+ </main>
77
+ </body>
78
  </html>