Tokens from an AI Agent Call

I am considering how to show traces for agent evaluation, and I noticed that in the UI, we can see the trace in the logs, including tokens, etc. However, that data does not appear to be exposed. Am I missing something?

Context: I am using VertexAI models, and while I can make a singular API call with my Service account and use the API response to form the trace and output metadata, I was hoping to keep this classroom-friendly for my students and lean into the AI nodes (Simple LLM or AI Agent Node).

Are the trace and metadata available and accessible in downstream node from the built-in nodes?

Hey @datanerdery3, while you wait for a response, here are some things that might help:

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@Mayank1024, @mohamed3nan, @darrell_tw - you’ve helped with similar issues before, can you take a look?

Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.

Hi again @datanerdery3 ,

Yes, you can keep the built-in AI nodes and read the trace back downstream. Set workflow Settings → Save execution progress to Save. After the Agent or Basic LLM Chain, add an n8n node with an API credential for your instance: Execution > Get, Execution ID {{ $execution.id }}, and Include Execution Details enabled.

Look under data.resultData.runData["Google Vertex Chat Model"], using your model node’s actual name. Each array entry represents a model call; its data.ai_languageModel[0][0].json contains the response plus tokenUsage or tokenUsageEstimate. Keep estimates labelled as estimates. Progress saving can increase latency, and this needs n8n API access, which isn’t available on the Cloud free trial.

Confirmed example

That is fantastic, thank you! I had no idea this was possible and that there were nodes to interact with the API, and even the execution itself.

This is useful. For agent evaluation, I think it’s important to capture more than the final output.

Tracking token usage, multiple model calls, execution status, and errors can help make AI workflows easier to evaluate and maintain. I’d also distinguish actual token usage from estimated usage so the metrics remain accurate.

I’m exploring workflow reliability in my n8n + FastAPI + PostgreSQL demo, particularly duplicate handling, concurrent requests, and database-failure recovery. Combining execution traces with reliability metrics could provide a more complete picture of workflow behavior.

storing session state in temporary project keys creates severe path resolution bugs when background workers restart. caching state in a persistent project manifest prevents lost references across application lifecycle events.

resolving canvas paths against a static workspace configuration file rather than dynamic environment variables ensures that publish handlers can locate files regardless of how the editor session launched.

are you planning to bind canvas identifiers to a fixed workspace root or persist them in local storage?