Scenario examples
Choose a business task, then follow data preparation, YAML selection, Server/TUI startup, questions, and output/trace checks. The first two cases use the same nl2sql plugin and five sample orders; de-agent uses existing enterprise metadata to generate engineering SQL.
Choose an execution path
| Scenario | Task | Configuration and execution | Guide |
|---|---|---|---|
| Dedicated NL2SQL queries | A defined question needing SQL and structured results | dataagent.entry: nl2sql, directly running the compiled SQL workflow |
SQLite to CSV |
| Parent/subagent analysis | Read query results, compare them, and write a report | entry: null or omitted; main Agent delegates to nl2sql through task and continues |
Parent/subagent case |
| de-agent data engineering | Generate CREATE, INSERT, or add-column files from registered metadata | Enable de-agent; root coordinates metadata retrieval, SQL generation, and checks |
Data engineering case |
The first two enable plugins.enabled: [nl2sql] and configure the workflow in plugins.config.nl2sql. nl2sql-react is a different plugin, not the name of this parent/subagent arrangement. de-agent's default chain generates engineering SQL; the CSV expectations below do not apply to it. Follow its case for services and execution boundaries.
Shared SQLite data and expected results
The two NL2SQL cases use orders(id, region, amount_cents):
| Order | Region | Amount, cents |
|---|---|---|
| 1 | north | 1200 |
| 2 | south | 1700 |
| 3 | north | 3300 |
| 4 | south | 600 |
| 5 | east | 800 |
After model-driven execution, the actual CSV should contain:
region,total_cents
north,4500
south,2300
east,800The total is 7600 cents and north ranks first. Preparation below checks only the sample database: it calls no model and creates no DataAgent CSV or trace. Verify the actual artifacts after running a case.
Prepare shared data without a model call
Run this in a Bash terminal at the repository root. It uses only the python3 standard library. Each invocation creates a fresh temporary data directory and exports absolute paths for an independent Home, database, and schema:
export DATAAGENT_CASE_ROOT="$(mktemp -d)"
export DATAAGENT_HOME="$DATAAGENT_CASE_ROOT/home"
export DATAAGENT_TUTORIAL_SQLITE="$DATAAGENT_CASE_ROOT/orders.sqlite"
export DATAAGENT_TUTORIAL_SCHEMA="$DATAAGENT_CASE_ROOT/orders-schema.md"
python3 - <<'PYDATA'
import os
import sqlite3
from contextlib import closing
from pathlib import Path
schema = """CREATE TABLE orders (
id INTEGER PRIMARY KEY,
region TEXT NOT NULL,
amount_cents INTEGER NOT NULL
);"""
orders = [("north", 1200), ("south", 1700), ("north", 3300), ("south", 600), ("east", 800)]
database = Path(os.environ["DATAAGENT_TUTORIAL_SQLITE"])
schema_file = Path(os.environ["DATAAGENT_TUTORIAL_SCHEMA"])
with closing(sqlite3.connect(database)) as connection, connection:
connection.execute(schema)
connection.executemany("INSERT INTO orders (region, amount_cents) VALUES (?, ?)", orders)
totals = connection.execute(
"SELECT region, SUM(amount_cents) AS total_cents FROM orders "
"GROUP BY region ORDER BY total_cents DESC, region ASC"
).fetchall()
assert totals == [("north", 4500), ("south", 2300), ("east", 800)]
schema_file.write_text(schema + "\n", encoding="utf-8")
print("Home:", os.environ["DATAAGENT_HOME"])
print("Database:", database)
print("Schema:", schema_file)
print("Verified sample totals:", totals)
PYDATAKeep this terminal and start Server in the same terminal so it inherits these variables. DATAAGENT_TUTORIAL_SQLITE and DATAAGENT_TUTORIAL_SCHEMA are the values referenced by both example YAML files. Server initializes Home as needed. Retain the data directory until the task completes and you have kept the outputs you need.
Prepare Python/TUI dependencies and the model through quick start and manual source deployment. Model variables can go in repository-root .env, selected with --env-file .env; nonempty process values take precedence. Data preparation itself needs no model variables.
Start, ask, and inspect
After preparation, follow dedicated queries or parent/subagent analysis. Start Server with the corresponding YAML, then attach TUI from another terminal using --runtime-url. Use the actual Server/TUI session's thread ID and artifacts rather than the SDK examples' fixed thread names.
Before switching entry graphs, stop the original Server and repeat preparation for a new Home, or choose independent Homes and free ports. Do not resume the same checkpoint across the two graph shapes.
| What to establish | Evidence |
|---|---|
| Effective entry and field merging | The actual --config argument and configuration merging |
| Correct query result | Current session's CSV header, ordering, and three totals |
| Delegation and subsequent analysis | task(nl2sql), subagent reply, and main-Agent CSV reads/report writes |
| Failure location | This Server Home's runtime/logs/backend.log and troubleshooting |
| Model/tool relationships | The current session's trace files |
Each case ends with an optional SDK automatic-verification script. Those scripts prepare independent data and invoke the model; they are not prerequisites for preparing data for the normal Server/TUI flow. See session records and SQLite for Server/SDK persistence differences.