Skip to content

refactor(provider)!: rig-free provider stack, native Bedrock, minimal deps; refreshed scale claims - #110

Open
shadaj wants to merge 1 commit into
mainfrom
sandbox-25e5957d-5b39-4699-9237-ff282a9865d6
Open

refactor(provider)!: rig-free provider stack, native Bedrock, minimal deps; refreshed scale claims#110
shadaj wants to merge 1 commit into
mainfrom
sandbox-25e5957d-5b39-4699-9237-ff282a9865d6

Conversation

@shadaj

@shadaj shadaj commented Sep 1, 2026

Copy link
Copy Markdown
Member

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:
    OneOrManyVec, 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.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 1, 2026

Copy link
Copy Markdown

Deploying infinity with  Cloudflare Pages  Cloudflare Pages

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

View logs

… 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
shadaj force-pushed the sandbox-25e5957d-5b39-4699-9237-ff282a9865d6 branch from ce22c85 to f58c02c Compare September 1, 2026 19:20
@shadaj
shadaj marked this pull request as ready for review September 2, 2026 00:16
@shadaj
shadaj requested a review from a team September 2, 2026 00:16

@akainth015 akainth015 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReasoningDelta renames the reasoning field?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants