MCPcopy Create free account
hub / github.com/ScaleML/AgentSPEX / track_usage

Method track_usage

src/harness/agentic_loop/session.py:58–62  ·  view source on GitHub ↗

Accumulate token usage from an LLM response.

(self, usage: dict[str, int])

Source from the content-addressed store, hash-verified

56 self.messages.append(result)
57
58 def track_usage(self, usage: dict[str, int]) -> None:
59 """Accumulate token usage from an LLM response."""
60 self.total_tokens += usage.get("total_tokens", 0)
61 self.prompt_tokens += usage.get("prompt_tokens", 0)
62 self.completion_tokens += usage.get("completion_tokens", 0)
63
64 def get_usage_summary(self) -> dict[str, Any]:
65 """Return a summary of token usage."""

Callers 1

_inner_loopMethod · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected