Dashboard API¶
Dashboard chat models.
- class sqldbagent.dashboard.models.ChatMessageModel(**data)[source]¶
Bases:
BaseModelRendered chat transcript entry for dashboard surfaces.
- Variables:
role – Message role shown in the dashboard.
content – Human-readable message body.
kind – Original LangChain/LangGraph message type.
name – Optional tool or actor name.
status – Optional tool status marker.
- Parameters:
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.dashboard.models.DashboardThreadEntryModel(**data)[source]¶
Bases:
BaseModelPersisted dashboard thread summary used for thread selection.
- Variables:
thread_id – Stable thread identifier used by the LangGraph checkpointer.
datasource_name – Datasource identifier associated with the thread.
schema_name – Optional schema focus for the thread.
created_at – First time the thread was observed by the dashboard.
updated_at – Most recent time the dashboard refreshed the thread entry.
message_count – Number of rendered transcript messages currently known.
latest_snapshot_id – Latest snapshot bound into the thread state, if any.
last_user_message – Most recent user message preview.
last_assistant_message – Most recent assistant message preview.
- Parameters:
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
- class sqldbagent.dashboard.models.ChatSessionModel(**data)[source]¶
Bases:
BaseModelDashboard-ready snapshot of one agent conversation thread.
- Variables:
thread_id – Stable thread identifier used by the LangGraph checkpointer.
datasource_name – Datasource identifier backing the session.
schema_name – Optional schema focus.
messages – Rendered chat transcript entries.
dashboard_payload – Dashboard-friendly state payload from the agent state.
observability – Dashboard-friendly runtime and tracing status payload.
latest_snapshot_id – Latest known stored snapshot id.
latest_snapshot_summary – Latest known stored snapshot summary.
tool_call_digest – Compressed tool-call history from the agent state.
diagram_bundle – Stored schema-diagram bundle associated with the session.
prompt_bundle – Stored prompt bundle associated with the session.
example_questions – Snapshot-aware starter questions for the dashboard chat.
available_threads – Persisted dashboard thread summaries for selection.
- Parameters:
data (
Any)thread_id (str)
datasource_name (str)
schema_name (str | None)
messages (list[ChatMessageModel])
latest_snapshot_id (str | None)
latest_snapshot_summary (str | None)
diagram_bundle (DiagramBundleModel | None)
prompt_bundle (PromptBundleModel | None)
available_threads (list[DashboardThreadEntryModel])
- messages: list[ChatMessageModel]¶
- available_threads: list[DashboardThreadEntryModel]¶
- model_config: ClassVar[ConfigDict] = {}¶
Configuration for the model, should be a dictionary conforming to [
ConfigDict][pydantic.config.ConfigDict].
Dashboard chat service built on top of the persisted LangGraph agent.
- class sqldbagent.dashboard.service.DashboardChatService(*, settings=None, model=None, checkpointer=None)[source]¶
Bases:
objectRun persisted chat turns over the shared sqldbagent agent stack.
- Parameters:
- __init__(*, settings=None, model=None, checkpointer=None)[source]¶
Initialize the dashboard chat service.
- run_turn(*, thread_id, user_message, datasource_name, schema_name=None)[source]¶
Run one user turn through the persisted agent session.
- load_thread(*, thread_id, datasource_name, schema_name=None)[source]¶
Load the current persisted state for one thread.
- Parameters:
- Returns:
Dashboard-ready state snapshot for the thread.
- Return type:
- list_threads(*, datasource_name=None, schema_name=None)[source]¶
List persisted dashboard thread summaries.
- render_prompt_markdown(bundle)[source]¶
Render one stored prompt bundle as Markdown for dashboard downloads.
- Parameters:
bundle (
PromptBundleModel) – Prompt bundle to render.- Returns:
Human-readable Markdown prompt artifact.
- Return type:
- update_prompt_bundle_enhancement(*, datasource_name, schema_name, active, user_context, business_rules, answer_style, refresh_generated=False)[source]¶
Update prompt-enhancement state and regenerate the prompt bundle.
- Parameters:
datasource_name (
str) – Datasource identifier.schema_name (
str) – Schema name.active (
bool) – Whether the enhancement should be active.user_context (
str|None) – Freeform user context or domain notes.answer_style (
str|None) – Preferred answer style for downstream outputs.refresh_generated (
bool, default:False) – Whether DB-aware guidance should be regenerated.
- Returns:
Updated prompt bundle or
Nonewhen no snapshot exists yet for the schema.- Return type:
PromptBundleModel|None