Skip to content

Ekoynov/251 improve claude code executor#256

Open
pickleerik wants to merge 99 commits intomainfrom
ekoynov/251-improve-claude-code-executor
Open

Ekoynov/251 improve claude code executor#256
pickleerik wants to merge 99 commits intomainfrom
ekoynov/251-improve-claude-code-executor

Conversation

@pickleerik
Copy link
Contributor

@pickleerik pickleerik commented Mar 12, 2026

  • Added dce support

… update method signatures for improved clarity and usability.
…hain_tools.py` and update imports across executors.
… `RUN_SQL_QUERY_TOOL_DESCRIPTION` for improved clarity
# Conflicts:
#	databao/agent/api.py
#	databao/agent/duckdb/react_tools.py
#	databao/agent/executors/base.py
#	databao/agent/executors/claude_code/claude_model_wrapper.py
#	databao/agent/executors/claude_code/executor.py
#	databao/agent/executors/langchain_tools.py
#	databao/agent/executors/utils.py
@pickleerik pickleerik marked this pull request as ready for review March 18, 2026 07:50
@pickleerik pickleerik requested a review from a team March 18, 2026 07:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Databao Context Engine (DCE) context-search tooling support to the Claude Code executor path, and refactors shared DuckDB SQL execution + context-search logic to reusable utilities.

Changes:

  • Centralize execute_duckdb_sql into a new databao.agent.duckdb.utils module and update executors to use it.
  • Add DCE context search helpers (including query expansion + RRF) into executors/utils.py and reuse them from LangChain tools.
  • Enable and wire a search_context MCP tool for Claude Code when the active domain supports DCE context.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
databao/agent/executors/utils.py Adds DCE context search helpers and query-expansion search implementation.
databao/agent/executors/react_duckdb/executor.py Updates DuckDB SQL execution import to the new shared helper.
databao/agent/executors/langchain_tools.py Refactors DCE search tools to reuse shared search helpers; introduces tool description constants.
databao/agent/executors/claude_code/executor.py Enables DCE search for Claude Code when domain supports context; passes domain into wrapper.
databao/agent/executors/claude_code/claude_model_wrapper.py Adds MCP search_context tool when domain is _DCEProjectDomain.
databao/agent/duckdb/utils.py New shared implementation of execute_duckdb_sql.
databao/agent/duckdb/react_tools.py Removes duplicated SQL helper; imports shared helper; avoids potential circular import via local import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

to get the best results.

Args:
query: Natural language query to search the context for relevant results.
@@ -0,0 +1,16 @@
import pandas as pd
from _duckdb import DuckDBPyConnection
Comment on lines +185 to +209
if self._domain.supports_context:
if isinstance(self._domain, _DCEProjectDomain):

@tool(
"search_context",
SEARCH_CONTEXT_TOOL_DESCRIPTION,
{"retrieve_text": str},
annotations=ToolAnnotations(readOnlyHint=True),
)
async def search_context(args: dict[str, Any]) -> dict[str, Any]:
if retrieve_text := args.get("retrieve_text", ""):
return {
"content": [
{
"type": "text",
"text": json.dumps(_search_context(retrieve_text, domain=self._domain)), # type: ignore[arg-type]
}
]
}
return {"content": [{"type": "text", "text": json.dumps({"error": "No retrieve text provided"})}]}

tools.append(search_context)
else:
raise ValueError(f"Search context tool is not supported for domain type: {type(self._domain)}")

"content": [
{
"type": "text",
"text": json.dumps(_search_context(retrieve_text, domain=self._domain)), # type: ignore[arg-type]
Comment on lines +77 to +83
def search_context(query: str, *, domain: _DCEProjectDomain) -> list[dict[str, Any]]:
"""Search the context for relevant information matching the given query text.
Args:
query: Natural language query to search the context for relevant results.
domain: The domain object to use to search the context.
"""
search_result_list = domain.search_context(query, datasource_name=None)
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.

3 participants