Daita Logo

from_db Modes

Choose the right Agent.from_db() behavior preset for simple lookup, analyst workflows, governed production usage, or data-team workflows.

#Overview

mode chooses a bundle of defaults for Agent.from_db(). Explicit parameters always override mode defaults.

python
agent = await Agent.from_db(
    "postgresql://user:pass@host/db",
    mode="governed",
)

#Mode Summary

ModeBest forAnalyst toolsLineageHistoryData quality
simplelightweight lookup and small schemasoffoffoffoff
analystgeneral analytics and explorationonoffoffoff
governedsafer production Q&Aonononoff
data_teamdeeper data operationsonononon

#Defaults

Settingsimpleanalystgoverneddata_team
read_onlyTrueTrueTrueTrue
toolkitNoneanalystanalystanalyst
include_sample_valuesFalseFalseFalseFalse
query_default_limit50502550
query_max_rows100200100200
query_max_chars25000500002500050000
query_timeoutnonenone3060
lineageFalseFalseTrueTrue
historyFalseFalseTrueTrue
qualityFalseFalseFalseTrue

#simple

Use simple when you want a smaller tool surface and bounded query results:

python
agent = await Agent.from_db(
    "sqlite:///./local.db",
    mode="simple",
)

This skips the analyst toolkit but still gives the agent database query and schema capabilities.

#analyst

analyst is the default. Use it for general exploratory analytics:

python
agent = await Agent.from_db(
    "postgresql://user:pass@host/db",
    mode="analyst",
)

This enables the analyst toolkit, including pivoting, correlation, anomaly detection, entity comparison, similarity search, and trend forecasting for SQL databases.

#governed

Use governed for production Q&A where history, lineage, and tighter query limits matter:

python
agent = await Agent.from_db(
    "postgresql://user:pass@host/db",
    mode="governed",
    allowed_tables=["orders", "customers", "products"],
    blocked_columns=["email", "phone"],
)

governed lowers the default LIMIT and result caps, enables lineage, and enables conversational history.

#data_team

Use data_team when data-quality tools should be available:

python
agent = await Agent.from_db(
    "postgresql://user:pass@host/db",
    mode="data_team",
)

data_team enables lineage, history, analyst tools, and data-quality tools.

#Overrides

Explicit arguments override mode defaults:

python
agent = await Agent.from_db(
    "postgresql://user:pass@host/db",
    mode="simple",
    toolkit="analyst",
    query_max_rows=500,
)

Use overrides when a mode is mostly right but needs one or two adjustments.