Skip to content

Remove built-in agent dynamic context#2174

Merged
gold-silver-copper merged 2 commits into
mainfrom
agent/remove-rig-dynamic-context
Jul 17, 2026
Merged

Remove built-in agent dynamic context#2174
gold-silver-copper merged 2 commits into
mainfrom
agent/remove-rig-dynamic-context

Conversation

@gold-silver-copper

Copy link
Copy Markdown
Contributor

What changed

  • remove AgentBuilder::dynamic_context, ExtractorBuilder::dynamic_context, DynamicContextStore, and all runner/request plumbing
  • migrate passive-RAG examples to small application-owned AgentHook::on_completion_call implementations
  • preserve retrieved-tool query selection and the vector-index Tool implementation
  • document passive hook-based RAG versus active tool-based RAG
  • add regression coverage for blocking/streaming hook context, retrieval failure, extractor hooks, query selection, vector tools, and source-tree API removal

Why

Hardcoded passive retrieval embedded application policy in agent request construction. Hooks already provide the correct per-turn policy boundary and behave consistently across blocking, streaming, and extractor execution.

Impact

This is a breaking API removal. Callers should replace .dynamic_context(samples, index) with a local completion-call hook that queries the index and patches RequestPatch::extra_context. Retrieval failures can stop the run before provider I/O. Model-directed retrieval remains available by exposing a vector index or custom retriever as a tool.

Root cause

The original dynamic-context feature coupled vector retrieval, query selection, document formatting, and error policy to the core completion builder. Removing that special path leaves one managed execution lifecycle and makes retrieval policy explicit.

Verification

  • cargo fmt --all
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test
  • cargo doc --workspace --no-deps
  • cargo check -p rig-core --target wasm32-unknown-unknown --features wasm
  • targeted migrated-example checks and independent full-diff review

External-service-backed examples were compiled but not executed.

@gold-silver-copper
gold-silver-copper marked this pull request as ready for review July 17, 2026 03:51
@gold-silver-copper
gold-silver-copper added this pull request to the merge queue Jul 17, 2026
Merged via the queue into main with commit bbab7e3 Jul 17, 2026
6 checks passed
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.

1 participant