Workflow Orchestration · Python SDK harness

Build a Human-Reviewed SQL Agent with LangGraph

A LangGraph Python tutorial builds a SQLite question-answering workflow that inspects tables and schema, drafts and checks SQL, then pauses for human review before query execution.

Evidence DocumentedAgent LangGraph SQL AgentHarness Python SDK harnessAdded 1 Dec 2026

What This Workflow Does

Provides database tools for listing tables and retrieving schema, then generates and checks a SQL query.

Uses LangGraph's Graph API to route a generated query to checking, or end when the model has already returned a response without a tool call.

Pauses before executing the SQL query so a person can approve the tool call, edit its arguments, or provide feedback.

Uses persistence to hold the interrupted run for review; the documentation says it can remain paused as long as the persistence layer remains alive.

Written for Application developers building database assistants. Goal: Workflow Orchestration.

Agent, Harness & Requirements

The workflow runs on LangGraph SQL Agent inside a Python SDK harness. You embed the agent loop in Python and own the tools, state, and deployment.

  • Python implementation using LangGraph's Graph API and the Python sqlite3 module.
  • A tool-calling model; the guide lists OpenAI, Anthropic, Azure, Google Gemini, AWS Bedrock, Hugging Face, and OpenRouter as options.
  • A SQLite database; the tutorial uses the Chinook sample database, which the guide says is hosted on a public Google Cloud Storage bucket.
  • A LangGraph persistence layer for pausing and resuming the human-review step.
  • LangSmith setup and environment variables are described for inspecting runs; use LangSmith if tracing is desired.

How It Works

  1. Choose a tool-calling model and configure the SQLite Chinook sample database.
  2. Add database-interaction tools, including table listing, schema retrieval, and SQL query access.
  3. Create graph nodes for listing tables, retrieving schema, generating a query, and checking the query.
  4. Assemble the nodes in the Graph API, routing generated queries through the checker and ending when there is no tool call to run.
  5. Wrap query execution with a human-in-the-loop interrupt and persistence; allow the reviewer to approve, edit arguments, or give feedback before execution.

Documented tutorial configuration (workflow summary, not executable code)

Model: any listed tool-calling provider/model
Database: SQLite with Chinook sample data
Graph stages: list tables → get schema → generate SQL → check SQL
Execution gate: human interrupt before query execution; reviewer may approve, edit arguments, or give feedback
Persistence: retain the interrupted run while the configured persistence layer remains alive

Evidence & Source

Documented LangGraph's official documentation describes a tutorial implementation, including its graph stages and human-review pattern. This is a provider-authored demo, not an independently reproduced workflow or a reported production result.

Build a custom SQL agent

LangGraph official documentation · checked 1 Dec 2026

Open the source

Limitations

  • The documented example uses the Chinook sample SQLite database; the tutorial does not establish suitability for other schemas or production deployment.
  • The human-review pause depends on persistence; the source says the run can remain paused only as long as the persistence layer is alive.
  • The tutorial advises reviewing queries for unintended actions or inefficiencies; it does not report independent accuracy, security, performance, or cost results.

This record describes what the source states. It is not a review, a benchmark, or a recommendation. If the tool has changed since the check date, report it.