Clinical AI Kit home Documentation hub / DB Intelligence Pipeline

DB Intelligence Pipeline

SequentialAgent containing 6 specialist LLM agents translates natural language into safe SQL with validation and explicit approval preparation before execution, followed by chart-spec generation. Lanes: Agents, Safety Gate.

flowchart TD
    subgraph LANE_AG["Lane: Pipeline agents"]
        SD["schema_discovery_agent (flash-lite)
get_database_schema"] NL["nl_to_sql_agent (pro)
generate_sql"] EX["query_executor_agent (pro)"] IC["insight_chart_agent (pro)
generate_chart_spec, save_query_to_memory"] end subgraph LANE_GATE["Lane: Safety gate"] SV{sql_validator_agent (flash-lite)
validate_sql_safety} APPR{sql_preview_approval_agent (pro)
approve_sql_preview} end START([Natural-language question]) --> SD --> NL --> SV SV -->|unsafe| REJ([Rejected + logged]) SV -->|safe| APPR APPR -->|direct| RUN["execute_clinical_query"] APPR -->|preview approved| RUN2["execute_approved_clinical_query"] RUN --> IC RUN2 --> IC IC --> DONE([Table / chart / CSV export + history + audit])

Key facts:

Related: Agent Architecture · End-to-End Request Flow