Let hosts register tools and observe token usage #4

Merged
weichen merged 2 commits from feature/host-tools into main 2026-10-01 09:35:55 +00:00
Owner

Summary

  • Host tools register into the kernel workspace and fail closed on a name clash.
  • Usage is a process event, and each step exposes its work directory plus a tool-call cap.

Test plan

  • go test ./adapters/native/ ./runtime/ -count=1
## Summary - Host tools register into the kernel workspace and fail closed on a name clash. - Usage is a process event, and each step exposes its work directory plus a tool-call cap. ## Test plan - [x] go test ./adapters/native/ ./runtime/ -count=1
weichen added 2 commits 2026-10-01 09:35:44 +00:00
Why: product runners need register_artifact and card tools inside the kernel loop, and the UI needs token usage on the same event stream as text and tool calls.
Evidence: go test ./... in agent-native; TestHostToolAndUsageEvent and TestHostToolNameConflictFailsClosed.
Impact: Options.HostTools fail closed on name clashes; ProcessEvent and runtime events gain a usage type with token counts. Existing callers that ignore unknown event types stay compatible.
Refs: deliverable-quality-system B1
Co-authored-by: Cursor <cursoragent@cursor.com>
Expose the step directory and a tool-call cap
ci / vet-and-test (pull_request) Failing after 2s
ci / docker-checkout-hostgateway (pull_request) Successful in 2s
cfc840c11d
Why: Host tools need the kernel workspace to register files the step just wrote, and product budgets must stop a step that keeps calling tools.
Evidence: go test ./adapters/native/ ./runtime/ -count=1 passed, including the workdir visibility test.
Impact: Host tools can read WorkDir from context. MaxToolCalls limits one kernel step when the request budget leaves it unset.
Refs: deliverable-quality-system B1
Co-authored-by: Cursor <cursoragent@cursor.com>
weichen merged commit ec731addef into main 2026-10-01 09:35:55 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-Native#4