Version 1.2.2. Added usage overview. Shows token used and cost in $.
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user