feat(tools): add provider_quota agent tool#90
Open
prime-axiom wants to merge 1 commit into
Open
Conversation
Contributor
Author
|
Self-review (GitHub blocks author self-approval, so this comment is the merge-ready signal). Verified against the full checklist:
Ready for merge from my side. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The agent had no way to read its own LLM subscription quota. Users could see provider usage in the web UI, but the agent could not answer questions like "how much Claude quota is left?" or react to approaching limits.
Change
Adds a
provider_quotaagent tool that exposes the existing quota data to the agent. It is a thin read wrapper overQuotaMonitorService— no new quota-fetching logic:getSnapshot()for the cached snapshot (background-polled).refreshProvider(id)when called withrefresh: trueto force a live fetch.The tool accepts an optional
providerId(scope to one provider) and an optionalrefreshflag (force a live fetch). It returns normalized usage windows (utilization %, reset times) for the quota-capable providers (Anthropic Claude Pro/Max, ChatGPT Codex, OpenCode Go, z.ai). Wired into both the interactiveAgentCoreand background tasks via the sharedcreateBaseAgentToolsfactory.Testing
vitest run packages/core/src/quota-tool.test.ts— 10/10 passing.vitest run packages/core/src— 1053/1053 passing.eslintclean on all touched files.tsc --noEmitclean for@axiom/coreand@axiom/web-backend.Docs:
docs/concepts/tools.mdupdated with the new tool and a link to the provider quota monitoring section.