Repository navigation
Conversation
This branch has not been deployed
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.
In the WASM SDK,
call_llm_onceinsdks/wasm/src/agent.rsgives up withLLM request failed with status 429on the first rate limit, and nothing tracks spend, because the native retry and pricing code in edgecrab-core needs tokio. This PR adds two opt-inAgentOptions:maxRetries(same name as the Node SDK) retries 429 and 5xx with jittered backoff and waits forRetry-Afterwhen the server sends it, andbudgetUsdstops the agent before the next LLM call once priced spend reaches the limit, with anagent.costUsdgetter to read it. Both are off by default so current behaviour does not change, and models missing from the price table (Ollama, for example) are never counted or blocked. The pricing and backoff math come from llm-wasm, which has no async runtime; the wasm32 build is clean and I tested it in Node against a mock server (Retry-After honoured, 400 not retried, exhausted retries return the original error, budget blocks the next call). I maintain llm-wasm (MIT) and will keep it current.