Using sessions and traces
What you'll build: three tour-planning prompts called one after another as part of a single trip-planning "session," so you can see them grouped in the frontend, drill down into one call's trace, leave feedback on it, and jump back to the exact prompt that produced it.
Every gateway call is already recorded as a trace — a record of one request, its spans (a span is one unit of work, like the LLM call itself), tokens, and cost. A session is a lightweight way to say "these several traces belong to the same user flow." You tag each call with the same session id, and the frontend rolls them up into one view — handy when one user action (like planning a trip) triggers several prompt calls in a row.
1. Register the prompts
This guide uses a tour-planner theme: three separate prompts that together plan
a trip. Prompts → New prompt, create tour-itinerary-planner,
tour-budget-estimator, and tour-packing-list-generator, each with its own
system message and variables (e.g. {{ destination }}, {{ days }}). See
Version a prompt if you haven't created one before.

2. Call all three under one session
Send each prompt through the gateway with the same x-session-id header. Each
call still gets its own trace, but they all share the session id — that's the
only thing that ties them together as one flow.
curl -X POST "$ACRUXCORE_BASE_URL/gateway/chat/completions" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" \
-H "Content-Type: application/json" \
-H "x-session-id: tokyo-trip-plan-01" \
-d '{"prompt":{"name":"tour-itinerary-planner","alias":"production","variables":{"days":"3","destination":"Tokyo"}}}'
Repeat with tour-budget-estimator and tour-packing-list-generator, keeping
the same x-session-id. Open Observability → Sessions and the session
shows up with all three calls rolled into it — trace count, total tokens, and
the time span they happened in.

A session is never created directly — it's just a sessionId string that shows
up on one or more traces. The first call that uses a new session id "creates"
it; there's nothing to set up in advance.
3. Open the session and drill into a trace
Click the session row to see every trace that shares its id — one per prompt call, newest first.

Click any trace's timestamp to open it. Expand the LLM span to see the resolved model, token usage, latency — and a link back to the prompt version that produced this exact call.

4. Leave feedback
Scroll to the Feedback panel at the bottom of the trace (or use the thumbs on an individual span, if you want feedback scoped to just that unit of work). Pick thumbs up or down, optionally add a short label and comment, then submit.

Once saved, your feedback appears in the list above the form, and the expanded span shows a "View traces for this prompt version →" link — this is the path back to the prompt.

5. Navigate back to the prompt
Click that link. It takes you to the Traces list pre-filtered to only calls made against that one prompt version — confirming exactly which version this feedback belongs to.

From there, open Prompts and pick the same prompt by name (here,
tour-packing-list-generator) to go straight to its versions, aliases, and
editor — closing the loop from a piece of feedback all the way back to the
prompt that earned it.
Doing this over the API
Sessions and feedback are both first-class API resources, so you can build the same flow — call, group, read back, and record feedback — entirely from code.
- curl
- Node (SDK)
# List sessions
curl "$ACRUXCORE_BASE_URL/sessions" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY"
{
"data": [
{
"sessionId": "tokyo-trip-plan-01",
"traceCount": 3,
"totalCostUsd": null,
"totalTokens": 461,
"firstAt": "2026-07-12T18:36:44.950Z",
"lastAt": "2026-07-12T18:36:59.152Z"
}
],
"total": 1,
"page": 1,
"limit": 20
}
# Get one session and its traces
curl "$ACRUXCORE_BASE_URL/sessions/tokyo-trip-plan-01" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY"
{
"session": {
"sessionId": "tokyo-trip-plan-01",
"traceCount": 3,
"totalCostUsd": null,
"totalTokens": 461,
"firstAt": "2026-07-12T18:36:44.950Z",
"lastAt": "2026-07-12T18:36:59.152Z"
},
"traces": [
{
"id": "bede0c1b-3d8e-40ef-950d-f5198f453ee7",
"name": "tour-packing-list-generator call",
"sessionId": "tokyo-trip-plan-01",
"status": "ok",
"spanCount": 1,
"totalTokens": 177
}
]
}
# Leave feedback on a trace (omit spanId for whole-trace feedback)
curl -X POST "$ACRUXCORE_BASE_URL/traces/bede0c1b-3d8e-40ef-950d-f5198f453ee7/feedback" \
-H "Authorization: Bearer $ACRUXCORE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"rating":1,"label":"helpful-packing-list","comment":"Covers layering and rain gear well for Tokyo autumn."}'
{
"id": "edb758da-dea8-4681-998d-29d515d15020",
"traceId": "bede0c1b-3d8e-40ef-950d-f5198f453ee7",
"spanId": null,
"rating": 1,
"label": "helpful-packing-list",
"comment": "Covers layering and rain gear well for Tokyo autumn.",
"source": "developer",
"createdAt": "2026-07-12T18:40:23.697Z"
}
Neither chat() nor runToolLoop takes a prompt reference or custom
headers — for stored-prompt calls with a session id, use fetch/curl against
the gateway as shown. The SDK does let you tag your own reported spans with the
same sessionId so they roll up alongside the gateway traces, and read/rate
the trace afterwards with getTrace()/submitFeedback():
import AcruxCore from '@acruxcoreai/sdk';
const hub = new AcruxCore();
const { traceId } = await hub.trace({
name: 'tour-itinerary-planner call',
sessionId: 'tokyo-trip-plan-01',
spans: [
{
spanId: 'itinerary',
name: 'gpt-4o-mini',
kind: 'llm',
status: 'ok',
startTime: '2026-07-12T18:36:44.950Z',
endTime: '2026-07-12T18:36:49.025Z',
},
],
});
await hub.submitFeedback({
traceId,
rating: 1,
label: 'helpful-packing-list',
comment: 'Covers layering and rain gear well for Tokyo autumn.',
});
What's next
- Haven't inspected a single trace yet? Start with Trace and inspect an LLM call.
- Turn feedback into training data: evaluate a prompt.
- Stream responses and run a traced tool-calling loop from Node: chat, stream, and collect feedback with the SDK.
- Full field reference: Sessions and Traces in the API Reference.