feat(cloud): attribute planner token usage
This commit is contained in:
@@ -27,6 +27,7 @@ import httpx
|
||||
|
||||
from cloud.internal_api.models import PlannerDecisionError, PlannerDecisionResponse
|
||||
from host_agent.config import HostAgentConfig
|
||||
from host_agent.planner_context import current_planner_execution_context
|
||||
from runtime.tool_calling_client import ToolCallDecision, ToolCallUnavailable, ToolCallUsage
|
||||
from runtime.tool_specs import ToolSpec
|
||||
|
||||
@@ -70,6 +71,15 @@ class CloudProxyToolCallingClient:
|
||||
],
|
||||
"timeout_seconds": timeout,
|
||||
}
|
||||
context = current_planner_execution_context()
|
||||
if context is not None:
|
||||
payload.update(
|
||||
{
|
||||
"task_id": context.task_id,
|
||||
"attempt": context.attempt,
|
||||
"lease_id": context.lease_id,
|
||||
}
|
||||
)
|
||||
try:
|
||||
response = self._client.post(
|
||||
f"/internal/v1/hosts/{self.config.host_id}/planner/decide",
|
||||
|
||||
Reference in New Issue
Block a user