Draft a query from a written request
What It Does
A permitted person submits a written query request, optionally with an open query or settled predecessor for refinement. Clarification and unsupported responses are successful conversation outcomes without an executable draft.
The Flow
Validate the trimmed request, resolve the base dataset for the caller and check any supplied current query. Check the advisory allowance against the operation reservation estimate. Commit a working generation, then asynchronously invoke its worker with the workspace and generation identity. Rebuild the requester context and assemble permitted metadata and fenced request context. Keep the base and nearest whole datasets within the dictionary budget. Call the foundation with validation, bounded test-run and final-outcome tools, within the declared turn, tool, repair and time budgets. Apply deterministic defaults, validate the request and generation restrictions, and compile as the requester. Store an accepted query, clarification or unsupported outcome, or reject the final output. Poll the outcome and load an accepted draft into the designer for inspection and ordinary user-triggered execution.
When Something Fails
Refuse malformed input or missing access before admission. No generation row is created by these refusals. Refuse insufficient allowance with the foundation code and credit information. No generation is admitted by this allowance refusal. An observed invocation failure immediately settles the generation as failed. A crash after commit but before invocation can leave working status until reconciliation. Fail if the base context cannot fit or required configuration is unavailable. The request settles with a code rather than a partial dictionary submission. Provider or foundation failures return declared codes; invocation settlement accounts for actual spend. A process interruption may require foundation reconciliation of the reservation. Conditional settlement records a failure code; diagnostics stay in logs. Only one outcome is retained, including any permitted model-authored explanatory content. Translate the stored code into the console failure message. The person can still build a query manually after generation failure.
Idempotency and Concurrency
Each submission creates a generation and can incur another metered invocation. Conditional working-status settlement prevents two stored verdicts, but does not prove that a duplicate invocation performs no inference. Worker concurrency bounds environment processing. Foundation reservations and in-flight limits provide the spending and simultaneous-call gates; a working predecessor cannot be refined.