Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
from databao.agent.core import Cache

from databao_cli.features.ui.project_utils import DatabaoProjectStatus, databao_project_status, has_build_output
from databao_cli.shared.executor_utils import DEFAULT_EXECUTOR
from databao_cli.shared.project.layout import ProjectLayout


def create_agent_for_tool(
project: ProjectLayout,
model: str | None = None,
temperature: float = 0.0,
executor: str = "claude_code",
executor: str = DEFAULT_EXECUTOR,
cache: Cache | None = None,
Comment thread
catstrike marked this conversation as resolved.
Comment thread
catstrike marked this conversation as resolved.
) -> Agent:
"""Create a Databao agent from a DCE project, configured for MCP tool use.
Expand Down
9 changes: 5 additions & 4 deletions src/databao_cli/features/ui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
has_build_output,
)
from databao_cli.features.ui.services.storage import get_cache_dir
from databao_cli.shared.executor_utils import DEFAULT_EXECUTOR
from databao_cli.shared.project.layout import ProjectLayout, find_project

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -60,7 +61,7 @@ def _save_settings_if_changed() -> None:

changed = False

current_executor = st.session_state.get("executor_type", "claude_code")
current_executor = st.session_state.get("executor_type", DEFAULT_EXECUTOR)
if settings.agent.executor_type != current_executor:
settings.agent.executor_type = current_executor
changed = True
Expand Down Expand Up @@ -105,7 +106,7 @@ def _initialize_agent(project: ProjectLayout) -> Agent | None:
return None

try:
executor_type = st.session_state.get("executor_type", "claude_code")
executor_type = st.session_state.get("executor_type", DEFAULT_EXECUTOR)

cache = _get_or_create_disk_cache()

Expand Down Expand Up @@ -254,7 +255,7 @@ def mark_welcome_completed() -> None:

settings = get_or_create_settings()
settings.welcome_completed = True
settings.agent.executor_type = st.session_state.get("executor_type", "claude_code")
settings.agent.executor_type = st.session_state.get("executor_type", DEFAULT_EXECUTOR)
llm: LLMSettings = st.session_state.get("llm_settings", LLMSettings())
settings.agent.llm = llm
save_settings(settings)
Expand Down Expand Up @@ -304,7 +305,7 @@ def init_session_state() -> None:
if "status_message" not in st.session_state:
st.session_state.status_message = None
if "executor_type" not in st.session_state:
st.session_state.executor_type = "claude_code"
st.session_state.executor_type = DEFAULT_EXECUTOR
if "llm_provider" not in st.session_state:
st.session_state.llm_provider = LLMSettings()

Expand Down
4 changes: 2 additions & 2 deletions src/databao_cli/features/ui/components/sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from databao_cli.features.ui.components.status import AppStatus, render_status_fragment, set_status
from databao_cli.features.ui.project_utils import DatabaoProjectStatus, databao_project_status
from databao_cli.features.ui.suggestions import reset_suggestions_state
from databao_cli.shared.executor_utils import EXECUTOR_TYPES
from databao_cli.shared.executor_utils import DEFAULT_EXECUTOR, EXECUTOR_TYPES
from databao_cli.shared.project.layout import ProjectLayout


Expand Down Expand Up @@ -105,7 +105,7 @@ def render_executor_selector() -> None:
"""Render executor type selector."""
st.markdown("### ⚙️ Executor")

current = st.session_state.get("executor_type", "claude_code")
current = st.session_state.get("executor_type", DEFAULT_EXECUTOR)

selected = st.selectbox(
"Executor type",
Expand Down
6 changes: 4 additions & 2 deletions src/databao_cli/features/ui/models/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import yaml

from databao_cli.shared.executor_utils import DEFAULT_EXECUTOR

_ENV_VAR_MAP: dict[str, str] = {
"openai": "OPENAI_API_KEY",
"anthropic": "ANTHROPIC_API_KEY",
Expand Down Expand Up @@ -53,7 +55,7 @@ def is_configured(self) -> bool:
class AgentSettings:
"""Agent-related settings."""

executor_type: str = "claude_code"
executor_type: str = DEFAULT_EXECUTOR
llm: LLMSettings = field(default_factory=LLMSettings)


Expand Down Expand Up @@ -105,7 +107,7 @@ def from_dict(cls, data: dict[str, Any]) -> "Settings":

return cls(
agent=AgentSettings(
executor_type=agent_data.get("executor_type", "claude_code"),
executor_type=agent_data.get("executor_type", DEFAULT_EXECUTOR),
llm=LLMSettings(
active_provider=llm_data.get("active_provider", "openai"),
providers=providers,
Expand Down
11 changes: 5 additions & 6 deletions src/databao_cli/features/ui/pages/agent_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from databao_cli.features.ui.app import _clear_all_chat_threads
from databao_cli.features.ui.components.status import AppStatus, set_status
from databao_cli.features.ui.models.settings import _ENV_VAR_MAP, LLMProviderConfig, LLMSettings
from databao_cli.shared.executor_utils import EXECUTOR_TYPES, LLM_PROVIDER_MODELS, LLM_PROVIDERS
from databao_cli.shared.executor_utils import DEFAULT_EXECUTOR, EXECUTOR_TYPES, LLM_PROVIDER_MODELS, LLM_PROVIDERS


def render_agent_settings_page(*, auto_apply: bool = False) -> None:
Expand All @@ -27,7 +27,7 @@ def render_agent_settings_page(*, auto_apply: bool = False) -> None:
"""
)

current = st.session_state.get("executor_type", "claude_code")
current = st.session_state.get("executor_type", DEFAULT_EXECUTOR)

selected = st.selectbox(
"Executor type",
Expand Down Expand Up @@ -66,8 +66,7 @@ def render_agent_settings_page(*, auto_apply: bool = False) -> None:
elif selected == "claude_code":
st.info(
"""
**ClaudeCodeExecutor** is the default and recommended executor.
It uses Claude Code as the execution backend for queries.
**ClaudeCodeExecutor** uses Claude Code as the execution backend for queries.
Requires a valid Anthropic API key configured in the LLM settings.
""",
icon="💡",
Expand Down Expand Up @@ -96,7 +95,7 @@ def render_agent_settings_page(*, auto_apply: bool = False) -> None:
provider_keys = list(LLM_PROVIDERS.keys())
current_provider = llm.active_provider if llm.active_provider in provider_keys else "openai"

is_claude_code = st.session_state.get("executor_type", "claude_code") == "claude_code"
is_claude_code = st.session_state.get("executor_type", DEFAULT_EXECUTOR) == "claude_code"

if is_claude_code:
chosen_provider = "anthropic"
Expand Down Expand Up @@ -194,7 +193,7 @@ def _persist_current_settings() -> None:
from databao_cli.features.ui.services.settings_persistence import get_or_create_settings, save_settings

settings = get_or_create_settings()
settings.agent.executor_type = st.session_state.get("executor_type", "claude_code")
settings.agent.executor_type = st.session_state.get("executor_type", DEFAULT_EXECUTOR)
llm: LLMSettings = st.session_state.get("llm_settings", LLMSettings())
settings.agent.llm = llm
save_settings(settings)
Expand Down
3 changes: 2 additions & 1 deletion src/databao_cli/features/ui/pages/general_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from databao_cli.features.ui.services.chat_persistence import delete_all_chats
from databao_cli.features.ui.services.settings_persistence import delete_settings
from databao_cli.features.ui.services.storage import get_cache_dir, get_chats_dir, get_storage_base_path
from databao_cli.shared.executor_utils import DEFAULT_EXECUTOR

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -47,7 +48,7 @@ def _confirm_reset_settings() -> None:
with col2:
if st.button("🔄 Reset", type="primary", use_container_width=True):
delete_settings()
st.session_state.executor_type = "claude_code"
st.session_state.executor_type = DEFAULT_EXECUTOR
st.session_state.databao_project = None
st.session_state.agent = None
_clear_all_chat_threads()
Expand Down
6 changes: 4 additions & 2 deletions src/databao_cli/shared/executor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

from databao.agent.configs.llm import LLMConfig

DEFAULT_EXECUTOR = "separate_executor"

EXECUTOR_TYPES = {
"separate_executor": "SeparateExecutor",
"claude_code": "ClaudeCodeExecutor (recommended)",
"separate_executor": "SeparateExecutor (recommended)",
"claude_code": "ClaudeCodeExecutor",
Comment thread
catstrike marked this conversation as resolved.
"lighthouse": "LighthouseExecutor",
"react_duckdb": "ReactDuckDBExecutor (experimental)",
"dbt": "DbtProjectExecutor (experimental)",
Expand Down
Loading