Configuration and usage migration from main_legacy to main
This document compares the Python Runtime and terminal CLI at main_legacy@7b2abeff with the Python Runtime and TUI at main@2903da39. Throughout this document, main means that fixed comparison version. For current installation and configuration, see deployment and configuration basics. The legacy Python CLI runs the Agent inside its terminal process. The newer version can still run in process through the SDK, or attach a TUI to dataagent serve.
Global configuration comparison
| Topic | main_legacy |
main |
|---|---|---|
| Configuration entry | python -m dataagent --config <yaml> and DataAgent.from_config(...) load the old YAML. Flex can load Suites through SUITE.include |
Use one product config.yaml in DataAgent Home (schema 4, also assumed when omitted), or select it with --config / LaunchOptions(config=...). Choose Home through DATAAGENT_HOME |
| Models | Configure MODEL.<alias>.provider/params. Flex can fill connections from <PROVIDER>_BASE_URL and <PROVIDER>_API_KEY |
models.<id> defines connections and dataagent.model selects the default. OpenAI-compatible services use provider: openai; model name, API root, and key can reference $env{NAME} |
| Environment variables | The old loader reads .env from the process launch directory; select YAML and the working directory independently |
Python Runtime reads Home .env or an explicit environment file, with nonempty process variables taking precedence. --config only selects YAML. A source TUI preloads checkout-root .env when launching its backend |
| Workspaces and databases | WORKSPACE.path sets a working root and WORKSPACE.allow_path adds allowed directories. SQL connections usually come from DATABASE |
Inputs use dataagent.input_workspaces; outputs use dataagent.output_root or SDK output_dir; plugins own database connections. Early newer-version YAML using dataagent.workspaces needs the field renamed |
| Extensions and semantics | Flex uses SUITE.include, TOOLS, SEMANTIC_LAYER, and related settings |
Enable plugins with plugins.enabled and place business settings in plugins.config.<id>. Host MCP settings live in Home or plugin-root .mcp.yaml; root semantic configures the semantic HTTP client |
| Users and sessions | Python CLI --user and --session select local session context and can continue an existing messages.json |
TUI uses the local user chosen at Server startup, defaulting to default. Home runtime/ stores the session index, Checkpoints, and bindings. Outputs default to <home>/outputs/<user>/<thread>/ |
The following example applies to old Flex configurations with provider: bailian. When running from runtime/dataagent/ in the old checkout, place connection settings in that directory's .env:
BAILIAN_BASE_URL=https://model.example.com/v1
BAILIAN_API_KEY=replace-with-your-keyThe model name remains in legacy YAML MODEL.<alias>.params.model. For provider: deepseek, use that provider's environment variables. In the newer version, put the same name, API address, and key in the new Home's environment file as LLM_MODEL, LLM_BASE_URL, and LLM_API_KEY and reference them from product YAML:
schema_version: 4
dataagent:
model: primary
input_workspaces:
- name: source-files
path: /data/migration/inputs
read_only: true
models:
primary:
provider: openai
name: $env{LLM_MODEL}
base_url: $env{LLM_BASE_URL}
api_key: $env{LLM_API_KEY}
server:
host: 127.0.0.1
port: 8790Input directories must already exist and be readable by the process. Omit input_workspaces if file inputs are unnecessary. Read-only declarations express the input contract; filesystem tools and shell still execute with host OS permissions. See configuration fields, CLI and environment, and security boundaries for deployment, listeners, and credentials.
Usage comparison
| Operation | main_legacy |
main |
|---|---|---|
| Python calls | Create an Agent through DataAgent.from_config(...) and execute await agent.chat(...) |
Call prepare_runtime(LaunchOptions(...)), then create_agent(...) and ainvoke/astream. The Python SDK still supports in-process execution |
| Terminal startup | From runtime/dataagent/ run uv run -m dataagent --config <yaml>. Configuration, model calls, and interaction stay in that process |
From the repository root run uv run --no-sync dataagent serve --config <yaml>; attach another terminal with npm run start:tui -- --runtime-url http://127.0.0.1:8790. Build source TUI with npm run build:tui |
| Session recovery | Restart Python CLI with the same --user and --session to load saved messages |
Use /resume <threadId> on the Server for the selected user, or pass --resume <threadId> when connecting. SDK calls select sessions through configurable.thread_id |
| Outputs | Inspect files under WORKSPACE.path or the default session workspace |
Use TUI /outputs or inspect the bound output directory. Outputs are separate from Checkpoints; changed input/output configuration affects new session bindings |
Recover a legacy CLI session with the following command. Run from runtime/dataagent/ in the old checkout and substitute the existing user and session IDs:
uv run -m dataagent --config config.yaml --user alice --session session-001Run both versions from separate checkouts, Python environments, and state directories. New TUI --runtime-url only connects to the selected Server; source TUI --config instead launches its own backend. Create a new session for the first migrated run, then verify recovery with /resume. See the new TUI guide and sessions and outputs.
Scenario 1: NL2SQL queries
Use the same read-only sales.sqlite database and ask “Count orders by region.” Both versions must use the same tables, columns, semantic database ID, and question. Compare SQL dialect, returned columns, row counts, and outputs.
main_legacy
Start with the NL2SQL Agent template in the standalone Python Runtime. Retain model and CORE node configuration and change these fields:
AGENT_CONFIG:
name: NL2SQL Agent
backend: langgraph
type: nl2sql
MODEL:
deepseek:
model_type: chat
provider: deepseek
params:
model: your-model-name
DATABASE:
db_id: sales
dialect: sqlite
config:
path: /data/migration/sales.sqlite
SEMANTIC_LAYER:
base_url: https://semantic.example.com
timeout: 30The old Flex parent Agent also has an NL2SQL subagent sample. It registers nl2sql_sub_agent_tool under TOOLS.local_functions and sets the model and nodes through the tool's config.llm_model and config.core_config. Database connections in that YAML come from DATABASE.
Save the modified standalone NL2SQL configuration as legacy-nl2sql.yaml. From the old checkout's runtime/dataagent/, run uv run --extra nl2sql -m dataagent --config /path/to/legacy-nl2sql.yaml, then enter the comparison question.
main
Start with nl2sql-entry.yaml, configure models.primary as above, and add SEMANTIC_BASE_URL and NL2SQL_DATABASE_PATH to the new Home's environment file. Combine this fragment and the model settings in one product YAML:
dataagent:
model: primary
entry: nl2sql
plugins:
enabled:
- nl2sql
config:
nl2sql:
model: primary
database:
db_id: sales
dialect: sqlite
engine: sqlite
path: $env{NL2SQL_DATABASE_PATH}
semantic:
base_url: $env{SEMANTIC_BASE_URL}| Legacy setting or behavior | Migration |
|---|---|
AGENT_CONFIG.type: nl2sql |
Use dataagent.entry: nl2sql to run the enabled compiled entry directly |
Flex nl2sql_sub_agent_tool |
Omit dataagent.entry and enable nl2sql, retaining the root Agent to delegate through task |
DATABASE.config.path, DATABASE.dialect, DATABASE.engine |
Flatten under plugins.config.nl2sql.database. For example, newer GaussVector uses dialect: postgres and engine: gaussvector. Replace legacy cloud_core with a supported connection |
CORE.perceptor/generator/validator/… or Flex core_config |
Move supported NL2SQL fields into plugins.config.nl2sql individually. For a supported UDN scenario previously selected through DATABASE.perceptor_type, use scenario such as udn.business_twin as shown in UDN configuration. Set the semantic-service scenario separately through semantic.semantic_scenario |
SEMANTIC_LAYER |
Use root semantic, setting the address, authentication, and timeout explicitly. Match request database IDs to the semantic service |
Check both the answer or subagent JSON and an empty error field. With successful execution and result files enabled, inspect session outputs nl2sql/<query_id>.csv and the matching .meta.json. Verify SQL, columns, fetched row count, and truncation flags. Use new threads separately for direct-entry and parent-Agent modes so differently shaped Checkpoints are not mixed.
Scenario 2: de-agent SQL deliverables
Compare the same data-engineering requirement, specifying source tables, identifiers, time window, and target table. Verify generated DDL/INSERT files. In a test environment, generate files first, then verify DataOps execution separately.
main_legacy
Use deagent_config.yaml as the baseline. It merges tools and Hooks through the enabled data_engineering Suite. This fragment identifies relevant old settings; retain the template's MODEL, SCENARIO, TOOLS, ACTOR_LOOP, and other sections:
AGENT_CONFIG:
name: data_engineering_agent
backend: langgraph
type: react
enable_human_feedback: false
hitl_auto_resolve: false
MODEL:
chat_model:
model_type: chat
provider: bailian
params:
model: your-model-name
SUITE:
include:
- data_engineering
DATABASE:
db_id:
- sales
SEMANTIC_LAYER:
base_url: https://semantic.example.com
timeout: 30
verify_ssl: false
HISTORY_SQL:
enabled: falseThe DATABASE.db_id list validates user-specified db.table names. Interaction combines AGENT_CONFIG, SCENARIO.chat.human_feedback_conditions, and DATA_TASK_IR; hitl_auto_resolve can also read evaluation answers. Model connections come from MODEL.<alias>.params or provider environment variables; see the legacy model implementation.
Save the modified Suite configuration as legacy-de-agent.yaml and run uv run --extra nl2sql -m dataagent --config /path/to/legacy-de-agent.yaml from the same legacy Runtime directory. Validate delivery using the prepared test source tables.
main
Start with examples/de-agent.yaml, adding your model address and the following scenario settings. Leave dataagent.entry omitted to retain the root Agent that coordinates the workflow.
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}
timeout_seconds: 30
plugins:
enabled:
- de-agent
config:
de-agent:
model: primary
allowed_databases:
- sales
dataops:
enabled: false| Legacy setting or behavior | Migration |
|---|---|
SUITE.include: [data_engineering] and the tools/Hooks merged with the Suite |
Enable de-agent. Its manifest depends automatically on nl2sql. Put deployment settings in plugins.config.de-agent. The manifest's defaults file supplies the Hive SQL generation chain and workflow Hooks required by de-agent |
MODEL.chat_model, SEMANTIC_LAYER.timeout/verify_ssl |
Unify model aliases. For an alias other than primary, check dataagent.model, plugins.config.de-agent.model, and plugins.config.nl2sql.model together. Move the semantic client to root semantic.timeout_seconds, semantic.tls.verify_server, and corresponding certificate fields |
DATABASE.db_id: [ … ] |
Move table-name validation allowlists to plugins.config.de-agent.allowed_databases. This differs from the single database.db_id used by standalone NL2SQL queries |
DATA_TASK_IR business options, enable_human_feedback, enable_ir_hitl, and automatic answers |
Put still-supported IR options such as semantic_check_policy and enable_ir_caliber_review in plugins.config.de-agent.data_task_ir. Register HITL with plugin hitl.policies and configure params; answer in TUI or handle interrupts from Python. Do not copy old automatic-answer settings or switches directly. See de-agent interaction migration |
HISTORY_SQL.enabled and legacy delivery guards |
Historical SQL maps to plugins.config.de-agent.history_sql.enabled. Prepare a corpus with history-sql. Delivery checks run when both plugin hitl.enabled and hitl.hitl_auto_resolve are true; pairing and confirmed-source checks share a two-reminder cap. Configure task-budget reminders separately with plugins.config.de-agent.delivery.task_wall_budget_seconds and max_model_calls |
| Trial calculations or data validation | Keep dataops.enabled: false when verifying SQL files. For real validation, configure DataOps separately, explicitly approve the execution scope, then invoke the current dataops_validate_data tool |
For custom HITL conditions, put model-facing instructions in the Markdown referenced by manifest hitl.instructions. Implement deterministic conditions in the policy handler and params. If retaining the built-in plugin, maintain these changes in its manifest and verify enabled declarations through configuration tests.
To verify the chain, inspect task(metadata-recall) and task(nl2sql) in a new session. Confirm that evidence comes from the current semantic backend and that agreed deliverables are generated, such as sql/create_<db.table>.sql and sql/insert_<db.table>.sql. If human confirmation is required, run a separate ambiguous task and confirm that answering resumes the same session. Check evidence and output layout against the plugin guide. A completed model reply or outer Task describes execution status; also verify SQL, business definitions, and actual files.
Migration steps and verification
- Keep the old environment. Record its YAML, model aliases, database, and semantic endpoints. Back up configuration, workspaces, session records, and outputs, and export the business files to migrate. Reinject credentials through existing credential management. Use a new Home and new sessions for verification.
- Rebuild shared configuration in the new environment. Install newer dependencies, set a new
DATAAGENT_HOME, and start from config.example.yaml for the model, services, required input directories, and plugins. Verify the health check and a minimal question before adding business plugins. Restart and create a new session after changing scenario settings. - Verify each scenario. For NL2SQL, start with a read-only database, known columns, and known row counts. For de-agent, generate SQL only first and check evidence, DDL/INSERT, and human confirmation before verifying stages that require real external services.
- Switch entry points and keep rollback available. Change in-process calls to the newer SDK and attach the newer TUI to the verified Server. To roll back, start the old Python CLI with the retained checkout, environment, YAML, and session arguments.
Legacy baseline
Run from runtime/dataagent/ in the old checkout. config check verifies configuration and environmental dependencies. --dryrun prints merged settings and should only be used with sample or redacted configuration:
uv run -m dataagent config check dataagent/agents/nl2sql/nl2sql_agent.yaml
uv run -m dataagent --config dataagent/core/flex/examples/deagent_config.yaml --dryrun
uv run --extra test pytest -q tests/ut/test_cli_config_dryrun.py \
tests/ut/interface/test_cli_session_runs.py tests/ut/suite/test_de_agent_suite_hook_wiring.pySee the standalone Runtime scenario test for the old NL2SQL real-query path. It requires configured models, a semantic service, and a database.
Current comparison baseline
After preparing the new Home and Bash environment, run from the main repository root. Replace config.yaml with the product YAML being verified. The first command checks configuration, variables, and plugin declarations; the second starts the control plane:
uv run --no-sync python -c 'import sys; from pathlib import Path; from dataagent import LaunchOptions, prepare_runtime; prepare_runtime(LaunchOptions(config=Path(sys.argv[1]))); print("configuration loaded")' config.yaml
uv run --no-sync dataagent serve --config config.yamlFrom another terminal, check the selected Server's listener. Both endpoints should return 200. If /ready returns 503, inspect Home runtime/logs/backend.log first.
curl -fsS http://127.0.0.1:8790/healthz
curl -fsS http://127.0.0.1:8790/readyAfter npm run build:tui, attach from another terminal with npm run start:tui -- --runtime-url http://127.0.0.1:8790. Run a conversation, then verify /resume restores it and /outputs finds generated files. Use npm run test:tui for client regression tests.
Checks that do not require a real model:
uv run --no-sync pytest -q -m 'not live' \
tests/test_config.py tests/test_product_api.py tests/test_plugin_configuration.py \
tests/test_nl2sql_plugin.py::test_compiled_entry_runs_nl2sql_and_writes_the_session_file \
tests/test_nl2sql_plugin.py::test_task_end_to_end_on_sqlite \
tests/test_de_agent_contracts.py tests/test_de_agent_ir_question_guard.py \
tests/test_de_agent_delivery_guards.pyThe de-agent live chain test requires test source tables, a usable model, and a semantic service. Set DATAAGENT_DE_AGENT_LIVE_ENV to an environment-file path containing the three LLM_* values, and DATAAGENT_DE_AGENT_LIVE_URL to the semantic-service root URL, then run:
uv run --no-sync pytest -q -m live tests/test_de_agent_live.pyThis test generates files and verifies delegation and delivery. Target SQL remains in files.