Sample data and usage code
This topic uses an order query and a follow-up question to illustrate how the three layers of data are transformed and consumed. Amounts, time, IDs, and messages use fixed values so that you can verify the fields and calculation relationships.
Sample data and usage code
Complete sample package: session-store-examples.zip. The package contains the JSON files listed on this page, scripts/session_view.py, and sql/session.sql.
File | Content |
source-trace.json | Two turns and six spans: two agents, three model calls, and one tool execution, with attributes/resources expanded |
source-trace.sls.json | The same input in the form of SLS string fields |
source-log.json | Eight log events for the two turns. The first turn covers four types of events. |
source-log.sls.json | The same log input in the form of SLS string fields |
trajectory-rows.json | The complete field format of the two-turn trace. Each row contains 46 business fields and four storage metadata fields. |
turn-1-atif.json, turn-2-atif.json | The corresponding atif_content expanded to make steps and usage easier to read |
trajectory-history.json | The old snapshot of the first turn, subsequent complete snapshots, and redelivered copies, in shuffled order |
session.json | The output of running the local Session composition script on the complete snapshot array |
delegation-atif.json, delegation-relationships.json | A parent-child structure with accurate tool call/observation/child references |
forest-atif.json, forest-relationships.json | A synthetic root that contains two independent roots and produces no delegation edges |
In the first turn, the tool result is carried in the observation of the agent step. In the second turn, the two copied historical steps retain the historical content but are not counted in the number of newly added outer steps.
Run
python3 scripts/session_view.py examples/trajectory-history.json \
--session-id session-demo-001 --source-kind otel_traceDownload and decompress the sample package, go to the package directory, and then run the preceding command. Only Python 3 is required. You do not need to install third-party dependencies. scripts/session_view.py can replace the input file to perform Session aggregation on the application side, and sql/session.sql can be used for scan queries.