Skip to content

[sight] bug: per-call token field is always null in audit records #699

Description

@jfeng18

AgentSight's genai_events.jsonl records have token and per_call_token always set to None, even when the LLM response contains valid usage data (e.g. input_tokens=16911, output_tokens=1).

Reproduce:

agentsight trace &
cosh -p "What is 2+2" --auth-type openai -y
cat ~/.agentsight/genai_events.jsonl | python3 -c "import sys,json; [print(json.loads(l).get("per_call_token")) for l in sys.stdin]"
# All None

Root cause: Two independent gates: (1) token extraction only runs when is_sse=true, missing non-streaming responses; (2) audit record creation also gated on is_sse, skipping non-SSE calls entirely. Additionally, is_sse was hardcoded in one path instead of reading from http_record.

Fix: PR #681

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions