feat(reflect): add multi-step reasoning with query decomposition#579
Open
bjornslib wants to merge 1 commit intovectorize-io:mainfrom
Open
feat(reflect): add multi-step reasoning with query decomposition#579bjornslib wants to merge 1 commit intovectorize-io:mainfrom
bjornslib wants to merge 1 commit intovectorize-io:mainfrom
Conversation
Extend the reflect agent with a decompose() tool for breaking complex queries into focused sub-questions: - Budget-gated: only available for MID and HIGH budget queries - ReasoningStep/ReasoningChain models for structured reasoning traces - Exposed via include_reasoning_chain parameter on reflect API - Fix Gemini tool schema compatibility (remove unsupported properties) - Fix reflect ValueError handler to pass actual error messages Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
I'm in the process of building out additional functions to support the "Second Brain" concepts discussed by Nate B. Jones. I've seen the automated tests fail? |
nicoloboschi
requested changes
Mar 16, 2026
Collaborator
nicoloboschi
left a comment
There was a problem hiding this comment.
I really like this idea but I think a better approach is to systematically split into parallel sub reflect agent and have a coordinator, instead of just decomposing and hoping the model will combine all researches together.
I think it's a much harder work but it's probably worth it.
Are you interesting in moving this PR to that approach?
if you don't have bandwidth it's fine
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.
Summary
additionalProperties,minItems,maxItems)Motivation
Complex queries that span multiple topics or require comparative analysis benefit from structured decomposition. Rather than building a separate multi-step system, this extends the existing reflect agent's agentic loop with a new
decompose()tool that the LLM can choose to use when appropriate.Modified files (all in reflect subsystem)
engine/reflect/tools_schema.py— TOOL_DECOMPOSE definition, budget parameter onget_reflect_tools()engine/reflect/tools.py—tool_decompose()handlerengine/reflect/prompts.py— MID/HIGH budget guidance for decompositionengine/reflect/agent.py— Dispatch + ReasoningChain constructionengine/reflect/models.py— ReasoningStep/ReasoningChain dataclassesengine/response_models.py— reasoning_chain field on ReflectResultengine/memory_engine.py— Chain serializationapi/http.py— Request/response fields for reasoning chainTest plan
🤖 Generated with Claude Code