de-agent data engineering: CREATE and add-column SQL
Complete a data-engineering task using existing enterprise metadata: retrieve source evidence, confirm business definitions, and generate CREATE/INSERT files, or read an existing table and INSERT to produce add-column changes. Unlike parent/subagent data analysis, this case delivers SQL files rather than a CSV query result.
Prerequisites and execution boundaries
Provide a working model, an already deployed SemanticLayer, and registered, retrievable source tables, columns, and descriptions. CREATE tasks also need the destination's naming conventions. Add-column tasks require an existing target's metadata and original INSERT; the user must supply the SQL if unavailable.
This page consumes an existing service. It invents no metadata-import API and does not create source tables automatically. Verify the connection through SemanticLayer integration. Replace source_db.source_table, target_db, target names, and new columns below with real objects permitted in your deployment. Example dates, fields, and target names are fictional; keep credentials, internal addresses, and business data out of documentation, screenshots, and shared traces.
The default de-agent NL2SQL chain is perceptor → generator → validator → reflector, without executor or selector. It generates SQL and needs no Spark/Hive execution driver. However, de-agent also has DataOps probing, trial, and validation tools, so the whole plugin cannot be described as never executing SQL. This example explicitly disables DataOps to focus on files and static checks; production trials need separate configuration and verification.
Prepare an independent Home and configuration
Prepare Python dependencies with manual source setup. From the repository root, select a new Home and copy the existing example:
export DATAAGENT_HOME="$(mktemp -d)"
cp examples/de-agent.yaml "$DATAAGENT_HOME/config.yaml"Edit that file to the following configuration, replacing target_db with your actual destination database:
schema_version: 4
dataagent:
model: primary
entry: null
models:
primary:
provider: openai
name: $env{LLM_MODEL}
base_url: $env{LLM_BASE_URL}
api_key: $env{LLM_API_KEY}
semantic:
base_url: $env{SEMANTIC_BASE_URL}
plugins:
enabled: [de-agent]
config:
de-agent:
model: primary
allowed_databases: [target_db]
dataops:
enabled: false
sql_checkers:
dataops_validation_enabled: false
data_task_ir:
enabled: false
enable_ir_caliber_review: false
server:
host: 127.0.0.1
port: 8790
run_timeout_seconds: 600| Setting | Example purpose and default behavior |
|---|---|
dataagent.entry: null |
Keep the coordinating root Agent. A direct nl2sql entry does not run de-agent root tools, Skills, or hooks |
plugins.enabled: [de-agent] |
Load de-agent and its declared local nl2sql dependency without enabling it twice |
plugins.config.de-agent.model |
Model alias for plugin operations; the root, default NL2SQL workflow, and metadata subagent all use primary here |
allowed_databases |
Used by validate_table_name to check database names. Default [] adds no restriction; it is neither retrieval scope nor warehouse authorization |
dataops.enabled: false |
Disable DataOps execution and the checker's DataOps phase in this example; plugin default is true |
sql_checkers.dataops_validation_enabled: false |
Explicitly select static delivery checks for this example; default is true, and disabling DataOps also disables this phase |
data_task_ir |
Both switches default to false; basic CREATE tasks do not require them. Optional use is described below |
Model connections belong in root models, semantic connections in root semantic, and product settings override plugin business defaults. Do not replace the generation-only NL2SQL chain with an execution chain. See the plugin documentation and configuration merging.
Provide LLM_MODEL, LLM_BASE_URL, LLM_API_KEY, and SEMANTIC_BASE_URL in repository-root .env. For Basic authentication or a deployment-specific scenario, add the fields described in SemanticLayer configuration. Nonempty values in the launching process environment override the selected file.
Start Server and connect TUI
In that same terminal:
uv run --no-sync dataagent serve \
--config "$DATAAGENT_HOME/config.yaml" --env-file .envThe YAML server section selects the listener. If the port is occupied, change this file and use the same port in the client URL. Prepare the client through the TUI guide, then connect from another terminal:
npm run start:tui -- --runtime-url http://127.0.0.1:8790Use /clear or a new session for this case. Server readiness does not establish that SemanticLayer contains correct business evidence; inspect actual metadata results during the task.
CREATE: from evidence to a SQL pair
Replace database and table identifiers before sending this question. It uses COUNT(*) rather than assuming additional business columns exist:
Use only registered source_db.source_table. First use metadata-recall to obtain its actual schema.
If that table cannot be confirmed, explain what is missing and stop rather than guessing another source.
Count all rows with COUNT(*), without filters or joins, and generate Hive SQL for target_db.example_row_count.
Use an EXTERNAL TABLE with row_total BIGINT COMMENT '总行数', partition
partition_date STRING COMMENT '日期分区', static partition '20250101', and STORED AS ORC.
Save valid CREATE DDL first, delegate INSERT generation to nl2sql through native task,
and perform static delivery checks. Generate files only: do not execute SQL or call DataOps.
Ask when naming rules or business definitions require confirmation.
Return the CREATE, INSERT, checker-report, and metadata-evidence paths, stating what remains unverified.The expected flow is:
Root Agent plans and reads the relevant Skills
→ task(metadata-recall) retrieves evidence from existing SemanticLayer
→ Root Agent writes and corrects CREATE DDL
→ task(nl2sql), with de-agent hooks supplying selected schemas, target DDL, and SQL rules
→ Hook saves INSERT
→ check_and_repair_sql checks files; root explains results and handles delivery confirmationNative task still takes subagent_type and description. At de-agent's NL2SQL boundary, description is a JSON string containing question and source_table. Selected sources must have actual schema evidence in this session, and question must identify one fully qualified target. The root Agent organizes these calls; users do not need to construct the JSON. Missing schema or DDL requires retrieval or correction rather than a seemingly successful INSERT.
Add columns: minimally modify an existing table and INSERT
The preceding case only generates files: it does not create a warehouse table or register that table in SemanticLayer. Choose another existing target for add-column work. To reuse the preceding target, first execute and register it through your normal processes.
This question assumes the real existing target and its INSERT already produce row_total, and permit an additional copy metric. Replace table names, columns, and metric definitions with your actual task:
Add row_total_copy BIGINT COMMENT '总行数副本' to existing target_db.existing_summary.
Retrieve its schema and current INSERT first, and confirm the INSERT already computes row_total.
Explain and ask for either missing item before proceeding.
The new column copies the existing row_total calculation. Add no source and preserve existing column
names, order, and business logic. Follow the add-columns workflow and return ALTER, modified INSERT,
and an itemized change description. Generate files only; do not execute them.
If the example column name violates deployment conventions, ask for an acceptable replacement.The workflow uses check_table_existence and query_sql_process, then the root minimally edits existing SQL. It does not reuse CREATE's NL2SQL generation path or treat a CREATE/INSERT-pair checker as an ALTER validator. If the target is absent, confirm whether the user wants a CREATE task rather than claiming add-column success.
Verify evidence, SQL, and check results
Find the current session from returned absolute paths and TUI /outputs. The default is <home>/outputs/default/<thread>/; these paths are relative to it:
| File | Evidence to inspect |
|---|---|
metadata/*.json |
kind, query, payload, recorded_at_ns: preserve qualified names, confirm actual columns, and require service evidence for joins/UDFs |
.semantic/<query-hash>.json |
Session cache of source candidates for the original question, pointing to raw evidence; not another business database |
sql/create_<db.table>.sql |
Root-created target DDL; check the confirmed target, columns, and partitions. Use the actual returned path |
sql/insert_<db.table>.sql |
INSERT saved by NL2SQL's completion hook; target matches valid DDL and sources match the selected evidence |
alter_*.sql, modified_insert_*.sql |
Add-column deliverables; check added-column order, preserved columns, and corresponding INSERT changes. Subdirectories follow actual output paths |
.runtime/sql_checkers/<id>/report.json |
CREATE/INSERT checking report; the tool also returns its actual report_path |
For CREATE, establish real task calls for both metadata-recall and nl2sql. The NL2SQL result should contain artifact_path and ddl_path without error; the checker should return status: PASS and passed: true. BLOCKED, ERROR, and service failures are not success. Since execution is disabled here, static success proves neither warehouse execution nor business values. Do not expect an NL2SQL CSV.
Optional IR and human feedback
To record a structured task definition, set plugins.config.de-agent.data_task_ir.enabled: true in the selected product configuration. Enable enable_ir_caliber_review: true when review before SQL generation is required. These existing capabilities are optional and default to false.
de-agent's manifest already enables HITL policies, so even the basic case can pause for clarification or delivery confirmation. Answer the pending question in TUI to continue rather than treating the pause as a failed run. See de-agent human feedback for business switches, manifest policies, and recovery; this case does not duplicate every parameter.
Inspect logs and traces
Backend diagnostics live in this Home's runtime/logs/backend.log, and traces in runtime/users/default/sessions/<thread>/traces/*.json. Locate the session and correlation IDs from this run. Trace filenames use native root run IDs rather than SQL filenames.
Follow the dataagent root through task(metadata-recall), metadata tools, DDL file tools, task(nl2sql), and the checker. Use tool results to locate evidence and deliverables. An add-column case instead reads existing SQL and edits files; it need not show CREATE's NL2SQL delegation. See logs and traces for field and search details.
| Symptom | Response |
|---|---|
| Metadata preload failure or missing source schema | Check the semantic connection, actual registered name, and returned evidence; a timeout is not table absence |
| Rejected DDL or INSERT | Read the specific rule diagnostic, confirm target and source selection, then correct the files rather than repeating writes |
Model attempts an old wrapped_* tool |
Check the current tool inventory and native task / nl2sql contract above; old names are not valid configuration or successful calls |
| Checker asks for DataOps | Confirm that this example disables dataops.enabled and the checker's corresponding phase; do not claim unperformed production validation |
| Original INSERT missing for add-column work | Supply registered sql_process metadata or ask the user for the SQL; a schema alone cannot establish the full calculation |
This guide follows current implementation and offline contract tests. It has not been integrated against a real model, SemanticLayer, or DataOps service. See test_plugin_configuration.py and test_de_agent_contracts.py for local contracts, and the existing explicit live tests when a real environment is available.