Repository navigation
feat: a bounded decision, a breaker, fail open on what a compiled answer can't honour - #12
Merged
Merged
Conversation
…wer can't honour - The whole decision call takes at most `timeout` (a name lookup or a slow drip included), and the server is told how long that is (x-agentcompiler-deadline-ms) and whether it is shadow mode (x-agentcompiler-mode: shadow, so it keeps no state). - After 5 failures in a row the SDK stops asking for 30 s, then lets one call through. - A request a compiled answer couldn't honour goes to the model without asking: n > 1, a forced tool_choice, a response_format, legacy functions. A tool call AgentCompile proposes that isn't among the request's tools is never answered. - next() and __anext__ read compiled and captured streams like the SDKs' own. - Capture batches stay under 4 MiB (a call over 7 MiB alone is dropped and counted). - No growth without bound: the trail moves aside at 10 MB, wrapping again reuses the capture sender, outcome() keeps one destination and lets finished threads go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Makes the wrapper safe to run in production.
Bounded in time
timeout, including name lookup, connect and a slow response.x-agentcompiler-deadline-ms), so it answers in time.shadowmode the SDK says so (x-agentcompiler-mode: shadow), and the server keeps no conversation state.Circuit breaker
Fails open on what a compiled answer can't honour
n> 1, a forcedtool_choice, aresponse_format, or legacyfunctions. The trail records them with the routeunsupported.toolsis never answered (fail-open, reasontool not offered).Behaves like the provider SDKs
next(stream)and__anext__read compiled and captured streams from where they are, as the SDKs' own streams do.Nothing grows without bound
Tested: 74 tests (16 new in
tests/test_hardening.py), ruff clean.🤖 Generated with Claude Code