Human feedback in de-agent
If an analysis task is missing a key definition such as the deduplication key, de-agent can pause for clarification. When pre-SQL review is enabled and its conditions are met, de-agent presents the extracted business definitions for review. The plugin can also request final confirmation before delivery. This page demonstrates those behaviors in a SQL task. See human interaction and recovery for the shared handler and recovery flow.
Configure a SQL task
Start with the de-agent example, set up the model and semantic service, and keep the default root Agent to orchestrate NL2SQL delegation. Merge the following settings into the product YAML to enable DataTaskIR and the optional one-time review before SQL generation.
plugins:
enabled:
- de-agent
config:
de-agent:
data_task_ir:
enabled: true
enable_ir_caliber_review: trueBoth IR switches default to false. The plugin's manifest already enables HITL and supplies the prompt instructions. Manifest policies control when execution pauses. The product YAML controls whether the IR workflow and the business review run.
Checks before completion
A guard is a policy that decides whether to pause and ask a question. Both completion checks run in after_model and skip responses containing valid or invalid tool calls.
| Policy | When it asks | Manifest parameter |
|---|---|---|
text_question_guard |
The last nonblank line of the model's text asks a recognizable question in Chinese. The first 2,000 characters of the full reply become the prompt. | text_question_max_fires defaults to 2 per user turn |
human_feedback_guard |
The model is about to finish. It asks for final confirmation once per user turn. | conditions defaults to [] and accepts a string or a list of confirmation items |
Registering the policy enables the guard. Remove its entry to disable it, or set hitl.enabled: false in the plugin manifest to disable all feedback from de-agent. These policies return the answer to the model for replanning. Counts update when a reply is accepted. Feedback generated by the middleware stays in the same user turn. The IR collector uses stable IDs to gather raw answers once.
IR clarification and review
ir_question_guard. When DataTaskIR is enabled, it checks unresolved blocking fields that have a question. The defaultafter_modelpolicy checks plans that delegate tonl2sqlor call a configured SQL consumer, and it also checks a text-only completion. It pauses the plan before those tools run. A custom host using serial tool calls can run this guard atbefore_toolinstead.ir_caliber_review. With both IR switches enabled, it presents a review of the extracted business definitions once per IR task beforetask(subagent_type="nl2sql")orde-agent__check_and_repair_sql. It asks after blocking clarification is complete. When the clarification limit is reached or the task enters best-effort mode, it reviews confirmed definitions and explains the remaining gaps. The answer is recorded as task IR feedback, used for replanning, and considered at the next extraction.
The IR question guard stores the raw answer in task-scoped ir_clarification. The extractor can then reassess the field. If a field remains unresolved after a reply, the task proceeds using confirmed fields and reports the gaps in the delivery. A new IR task resets the asking state.
Set IR clarification limits and consumers in the manifest's ir_question_guard policy params.
| Parameter | Default | Scope |
|---|---|---|
budget |
8 |
Maximum IR clarification answers per task, subject to the lower active limit |
hitl_question_guard_max_fires |
2 |
Maximum IR question guard firings per task |
hitl_max_same_fingerprint_asks |
2 |
Limit for the same set of unresolved questions |
hitl_max_same_field_asks |
2 |
Per-field cap. The guard already skips fields with a recorded answer |
hitl_blocking_fields |
identity, sources, time_context, output_features |
Fields considered for clarification |
consumerTools |
de-agent__check_and_repair_sql |
Tool names checked before running SQL work. Delegation to nl2sql is recognized independently |
The budget applies to IR clarification for that task. Completion guards use their separate per-turn counts.
Migrate legacy settings
Use manifest policy registration for the behavior previously selected by enable_human_feedback and enable_ir_hitl. Move custom limits formerly set under plugins.config.de-agent.hitl or the old IR HITL fields into the corresponding policy's params. Keep business settings such as data_task_ir.enabled, data_task_ir.model, and data_task_ir.enable_ir_caliber_review in the product YAML.
Use the final confirmation policy's conditions for a checklist. Put model-facing guidance from the old human_feedback_conditions or Initial/Mid/Final prompts in the Markdown file named by hitl.instructions. The current caller answers the interrupt in Web, TUI, or through the original integration entry point. The legacy hitl_auto_resolve setting has no equivalent.
Verify the scenario
- Start a new session with the de-agent configuration. Ask for a SQL delivery where the source metadata permits both
user_idanddevice_idand your request leaves the deduplication key unspecified. - When the session pauses, answer with the intended key and the source table if requested. Confirm the task continues in the same session. When review is enabled, check that it appears once before SQL generation after blocking clarification completes or the task enters best-effort mode.
- Check the generated SQL and delivery notes for the selected key and any remaining gaps. Answer the final confirmation if enabled. Also verify what happens when a clarification leaves a field unresolved.
The completion guard, IR question guard, and IR caliber review tests use local fixtures. You can run them together from the repository root.
uv run --no-sync pytest -q tests/test_de_agent_completion_guards.py \
tests/test_de_agent_ir_question_guard.py tests/test_de_agent_delivery_guards.py