Skip to content

Base

deep_db_agents.base

Abstract interface that every database dialect must implement.

DbDialect

Bases: ABC

Specialization of the agent for a database type.

A dialect provides two things: the generic system prompt that instructs the agent on how to operate efficiently on that database, and the set of tools (with credentials injected) to interact with it.

build_tools abstractmethod

build_tools(conn: ConnectionConfig, guardrails: GuardrailConfig, materialize_enable: bool = False) -> Sequence[BaseTool]

Build the LangChain tools bound to the connection and guardrails.

Parameters:

Name Type Description Default
conn ConnectionConfig

Connection parameters (host/port/credentials or file path).

required
guardrails GuardrailConfig

Hard safety thresholds enforced by the tool wrappers.

required
materialize_enable bool

Whether to expose the tool(s) that materialize large results to file instead of returning them inline.

False

Returns:

Type Description
Sequence[BaseTool]

Sequence[BaseTool]: The tools built for this dialect, with credentials

Sequence[BaseTool]

captured in their closures.

Source code in src/deep_db_agents/base.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
@abstractmethod
def build_tools(
    self,
    conn: ConnectionConfig,
    guardrails: GuardrailConfig,
    materialize_enable: bool = False,
) -> Sequence[BaseTool]:
    """Build the LangChain tools bound to the connection and guardrails.

    Args:
        conn: Connection parameters (host/port/credentials or file path).
        guardrails: Hard safety thresholds enforced by the tool wrappers.
        materialize_enable: Whether to expose the tool(s) that materialize large
            results to file instead of returning them inline.

    Returns:
        Sequence[BaseTool]: The tools built for this dialect, with credentials
        captured in their closures.
    """

system_prompt abstractmethod

system_prompt() -> str

Return the generic prompt for this database, concatenated with the user's own.

Returns:

Name Type Description
str str

The dialect-specific system prompt text.

Source code in src/deep_db_agents/base.py
29
30
31
32
33
34
35
@abstractmethod
def system_prompt(self) -> str:
    """Return the generic prompt for this database, concatenated with the user's own.

    Returns:
        str: The dialect-specific system prompt text.
    """