Skip to content

feat: expose RunnableConfig metadata to search providers - #64

Open
March-77 wants to merge 2 commits into
spring-ai-alibaba:mainfrom
March-77:codex/issue-59-search-runnable-metadata
Open

feat: expose RunnableConfig metadata to search providers#64
March-77 wants to merge 2 commits into
spring-ai-alibaba:mainfrom
March-77:codex/issue-59-search-runnable-metadata

Conversation

@March-77

@March-77 March-77 commented Aug 10, 2026

Copy link
Copy Markdown

Description

Expose RunnableConfig metadata to search providers through SearchRequest.getContext().getExtensions().

Search providers can now read runtime values such as a knowledge-base ID, per-agent topK, and score thresholds without adding them to the model-visible tool schema.

Root cause

BaseSearchCodeactTool received the framework ToolContext, but buildSearchRequest ignored it. As a result, the RunnableConfig metadata already injected by the agent framework was lost before the request reached SearchProvider.

Changes

  • Copy all RunnableConfig metadata into SearchContext.extensions while building a search request.
  • Use a defensive map copy so providers cannot mutate the config's metadata map.
  • Preserve existing behavior when no RunnableConfig or ToolContext is present.
  • Add tests for both configured and missing runtime context.

Validation

JAVA_HOME=/opt/homebrew/opt/openjdk@17 mvn clean test
9/9 Maven modules: SUCCESS
Tests run: 47, Failures: 0, Errors: 0, Skipped: 0

GitHub Actions checks are not configured/reported for this PR.

Fixes #59

@March-77
March-77 marked this pull request as ready for review August 10, 2026 11:31
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.

[FEATURE] 搜索工具支持从RunnableConfig获取数据

1 participant