refactor(provider)!: rig-free provider stack, native Bedrock, minimal deps; refreshed scale claims - #110
Open
shadaj wants to merge 1 commit into
Open
refactor(provider)!: rig-free provider stack, native Bedrock, minimal deps; refreshed scale claims#110shadaj wants to merge 1 commit into
shadaj wants to merge 1 commit into
Conversation
Deploying infinity with
|
| Latest commit: |
f58c02c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6f983505.infinity-dc7.pages.dev |
| Branch Preview URL: | https://sandbox-25e5957d-5b39-4699-9.infinity-dc7.pages.dev |
… deps; refreshed scale claims
Remove `rig` from the core provider/agent stack. `infinity-provider-protocol` now owns a
minimal model API; the Bedrock provider talks to the official AWS SDK directly
(eliminating the maintained `rig-bedrock` patch); rig survives only as an optional
bridge crate. Re-measured the memory benchmark and refreshed the landing/README claims.
## infinity-provider-protocol (rig-free, minimal core)
* Featureless dependency tree is just serde, serde_json, thiserror, async-trait,
futures-util — no HTTP stack, no LLM SDKs, no tokio.
* Own `message` types with JSON byte-compatible with the rig 0.31 types they replace,
locked in by literal-JSON serde tests (persisted histories keep loading). Cleanups:
`OneOrMany` → `Vec`, dropped always-unused fields (`ToolCall.signature`/
`additional_params`, assistant `id`, `Image.detail`, audio/video/document content).
* Own `completion` types: `CompletionRequest` trimmed to the five fields we use, and a
plain `ModelStream = Stream<Result<StreamChunk, CompletionError>>` replacing rig's
streaming machinery; `ModelProvider::invoke_model` returns it directly.
* Feature flags keep extras out of default builds:
- `mock` — channel-driven mock completion model (replaces the `rig-mock` crate). A
self dev-dependency enables it for the crate's own tests, which also removed the
duplicate inline mock that `remote.rs` tests previously needed. Downstream tests
dev-depend on the crate with `features = ["mock"]`.
- `remote` — the out-of-process transport and all its deps (tokio, tokio-util, uuid,
tracing, async-stream, futures-util/sink), gated `#[cfg(all(unix, feature =
"remote"))]` so a Windows transport can join behind the same flag later. Wire
simplification: requests are the serializable `CompletionRequest`; chunks travel
as `Result<StreamChunk, String>`.
## infinity-provider-bedrock (native AWS SDK)
* Rewritten on `aws-sdk-bedrockruntime` `converse_stream`; `rig-bedrock-patched` and
the root `[patch.crates-io]` are deleted. Same model catalog (incl. the
`claude-opus-4-6-v1:1m` picker entry mapping back to the real model id), params
merge (caller wins), per-model max_tokens defaults, and the prompt cache point
appended to the last message (the reason the patch existed).
* Request assembly factored into a pure `prepare_request` so policy behavior is
unit-testable without an AWS client; `invoke_model` is wiring + `.send()`.
* Improvements: mid-stream errors surface instead of silently ending the stream;
`Usage.cached_input_tokens` reports `cache_read_input_tokens`; SDK errors carry the
underlying service message (agent-core's retry string-matching still works).
## New optional crate
* `infinity-provider-rig`: bridge exposing any rig `CompletionModel` as a
`ModelProvider`, for out-of-tree rig backends. The in-tree stack does not use it.
## Consumers migrated
agent-core, daemon, cli, lambda, mcp-bridge, rap-bridge: new import paths, `vec![…]`
for `OneOrMany::one`, `Option`-returning `.first()`, de-genericized
`CompletionEvent`/`CompletionAction` (`Done(FinalResponse)`), lambda's
`aws_config::load_from_env` deprecation fixed. Insta snapshots updated (no more
`"id": null` / `"signature": null` noise).
## Tests kept intentional
Pruned tautological tests (implementation-mirror conversions, serde's own
unknown-field behavior, trivial defaults); kept contract tests: persisted-JSON
formats, Bedrock validation rules, cache-point placement, params/max_tokens/model-id
policies, reasoning round-trip, and the socket-transport integration tests.
## Benchmark + landing refresh
* Memory improved: re-ran `agent_scale` with the published configuration
(AGENTS=80000 TURNS=20 WAVE=4000, same AMD EPYC 9R14 class host): 8.41 GB @ 80k
agents vs 8.89 GB before (~103 KB/agent vs ~108; 76k agents measured at 8.0 GB).
Baseline main reproduced the published curve, so the delta is from this refactor
(dead-field removal outweighs the extra `Vec` in tool results — no tinyvec needed).
* `docs/src/components/MemoryChart.tsx` DATA refreshed (chart now annotates
"80,000 agents in 8.4 GB", "≈ 103 KB per agent").
* README + landing lead rewritten: "An open-source Rust framework for building
massively concurrent agentic systems, light enough to fit 75k agents in the memory
of a Raspberry Pi." (was "fifty/seventy thousand"); scale chapter now titled
"75k agents on a Raspberry Pi" with ~103 KB per agent.
## Validation
fmt, clippy `-D warnings` (incl. `--features e2e-web`), full workspace test suite,
Playwright web e2e (7/7), docs prettier clean, THIRD-PARTY regenerated (rig-bedrock
subtree removed, `aws-sdk-bedrockruntime` added).
BREAKING CHANGE: `infinity-provider-protocol` types replace rig types throughout;
`ModelProvider::invoke_model` returns `ModelStream`; the `remote` module and mock are
behind the `remote`/`mock` features; the provider wire `Chunk` frame shape changed
(daemon and provider binaries deploy together, as they already do); the `rig-mock`
and `rig-bedrock-patched` crates are gone.
Co-authored-by: Infinity 🤖 <infinity@hydro.run>
PR: #110
shadaj
force-pushed
the
sandbox-25e5957d-5b39-4699-9237-ff282a9865d6
branch
from
September 1, 2026 19:20
ce22c85 to
f58c02c
Compare
shadaj
marked this pull request as ready for review
September 2, 2026 00:16
akainth015
reviewed
Sep 2, 2026
akainth015
left a comment
Member
There was a problem hiding this comment.
Partial review, I haven't yet finished because it's a massive diff 😅
Comment on lines
-17
to
-25
| "call_id": null, | ||
| "function": { | ||
| "name": "execute_command", | ||
| "arguments": { | ||
| "command": "make build" | ||
| } | ||
| }, | ||
| "signature": null, | ||
| "additional_params": null |
Member
There was a problem hiding this comment.
It's not clear to me why these changed, though the fields are null so we may not care.
| r.content.first() | ||
| { | ||
| Some(t.text) | ||
| Some(t.text.clone()) |
Member
There was a problem hiding this comment.
ToolResultContent::Text(t) is now a type that needs to be .clone()'d? &str?
| ctrl.send_chunk(StreamChunk::ReasoningDelta { | ||
| id: None, | ||
| reasoning: "deep ".into(), | ||
| text: "deep ".into(), |
Member
There was a problem hiding this comment.
ReasoningDelta renames the reasoning field?
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.
Remove
rigfrom the core provider/agent stack.infinity-provider-protocolnow owns aminimal model API; the Bedrock provider talks to the official AWS SDK directly
(eliminating the maintained
rig-bedrockpatch); rig survives only as an optionalbridge crate. Re-measured the memory benchmark and refreshed the landing/README claims.
infinity-provider-protocol (rig-free, minimal core)
futures-util — no HTTP stack, no LLM SDKs, no tokio.
messagetypes with JSON byte-compatible with the rig 0.31 types they replace,locked in by literal-JSON serde tests (persisted histories keep loading). Cleanups:
OneOrMany→Vec, dropped always-unused fields (ToolCall.signature/additional_params, assistantid,Image.detail, audio/video/document content).completiontypes:CompletionRequesttrimmed to the five fields we use, and aplain
ModelStream = Stream<Result<StreamChunk, CompletionError>>replacing rig'sstreaming machinery;
ModelProvider::invoke_modelreturns it directly.mock— channel-driven mock completion model (replaces therig-mockcrate). Aself dev-dependency enables it for the crate's own tests, which also removed the
duplicate inline mock that
remote.rstests previously needed. Downstream testsdev-depend on the crate with
features = ["mock"].remote— the out-of-process transport and all its deps (tokio, tokio-util, uuid,tracing, async-stream, futures-util/sink), gated
#[cfg(all(unix, feature = "remote"))]so a Windows transport can join behind the same flag later. Wiresimplification: requests are the serializable
CompletionRequest; chunks travelas
Result<StreamChunk, String>.infinity-provider-bedrock (native AWS SDK)
aws-sdk-bedrockruntimeconverse_stream;rig-bedrock-patchedandthe root
[patch.crates-io]are deleted. Same model catalog (incl. theclaude-opus-4-6-v1:1mpicker entry mapping back to the real model id), paramsmerge (caller wins), per-model max_tokens defaults, and the prompt cache point
appended to the last message (the reason the patch existed).
prepare_requestso policy behavior isunit-testable without an AWS client;
invoke_modelis wiring +.send().Usage.cached_input_tokensreportscache_read_input_tokens; SDK errors carry theunderlying service message (agent-core's retry string-matching still works).
New optional crate
infinity-provider-rig: bridge exposing any rigCompletionModelas aModelProvider, for out-of-tree rig backends. The in-tree stack does not use it.Consumers migrated
agent-core, daemon, cli, lambda, mcp-bridge, rap-bridge: new import paths,
vec![…]for
OneOrMany::one,Option-returning.first(), de-genericizedCompletionEvent/CompletionAction(Done(FinalResponse)), lambda'saws_config::load_from_envdeprecation fixed. Insta snapshots updated (no more"id": null/"signature": nullnoise).Tests kept intentional
Pruned tautological tests (implementation-mirror conversions, serde's own
unknown-field behavior, trivial defaults); kept contract tests: persisted-JSON
formats, Bedrock validation rules, cache-point placement, params/max_tokens/model-id
policies, reasoning round-trip, and the socket-transport integration tests.
Benchmark + landing refresh
agent_scalewith the published configuration(AGENTS=80000 TURNS=20 WAVE=4000, same AMD EPYC 9R14 class host): 8.41 GB @ 80k
agents vs 8.89 GB before (~103 KB/agent vs ~108; 76k agents measured at 8.0 GB).
Baseline main reproduced the published curve, so the delta is from this refactor
(dead-field removal outweighs the extra
Vecin tool results — no tinyvec needed).docs/src/components/MemoryChart.tsxDATA refreshed (chart now annotates"80,000 agents in 8.4 GB", "≈ 103 KB per agent").
massively concurrent agentic systems, light enough to fit 75k agents in the memory
of a Raspberry Pi." (was "fifty/seventy thousand"); scale chapter now titled
"75k agents on a Raspberry Pi" with ~103 KB per agent.
Validation
fmt, clippy
-D warnings(incl.--features e2e-web), full workspace test suite,Playwright web e2e (7/7), docs prettier clean, THIRD-PARTY regenerated (rig-bedrock
subtree removed,
aws-sdk-bedrockruntimeadded).BREAKING CHANGE:
infinity-provider-protocoltypes replace rig types throughout;ModelProvider::invoke_modelreturnsModelStream; theremotemodule and mock arebehind the
remote/mockfeatures; the provider wireChunkframe shape changed(daemon and provider binaries deploy together, as they already do); the
rig-mockand
rig-bedrock-patchedcrates are gone.