Version 1.2.2. Added usage overview. Shows token used and cost in $.

This commit is contained in:
2026-04-15 10:00:39 +02:00
parent 752691fe54
commit d4c6420481
18 changed files with 1657 additions and 86 deletions

View File

@@ -277,12 +277,17 @@ class AgentRunner:
elif isinstance(event, ErrorEvent):
final_text = f"Error: {event.message}"
run_model = agent_data.get("model") or ""
from ..providers.models import compute_cost_usd
cost = compute_cost_usd(run_model, input_tokens, output_tokens) if run_model else None
await agent_store.finish_run(
run_id,
status="success",
input_tokens=input_tokens,
output_tokens=output_tokens,
result=final_text,
model=run_model or None,
cost_usd=cost,
)
logger.info(
f"[agent-runner] Agent '{agent_data['name']}' run={run_id[:8]} completed OK"