Home / Articles / Practical notes: ZQ Intelligence: Orchestrator-Specialist Agents for Financial

This article is published in English.

Practical notes: ZQ Intelligence: Orchestrator-Specialist Agents for Financial

Operable walkthrough of Practical notes: ZQ Intelligence: Orchestrator-Specialist Agents for Financial: contracts, checks, and drop-in code slots for teams shipping this pattern.

1664 words

Use this as an operator-facing rebuild of the ideas in “ZQ Intelligence: Orchestrator-Specialist Agents for Financial Analysis in Snowflake”: clear stages, ordered code slots, and recovery notes that survive a handoff. The Overview stage works best when treated as a measurable surface. Capture one golden transcript, one failure case, and the rollback note before expanding scope. Keep configuration outside application code. Environment files, secret stores, and feature flags belong in one place operators can audit without reading the whole graph.

ZQ Model as a Service: How It Powers the Snowflake Intelligence

For the ZQ Model as a stage, define the inputs, the owner of the step, and the exit criteria before changing code. Operators should be able to re-run the step from a known checkpoint without guessing hidden state. Document the happy path and the recovery path together. Retries, human gates, and dead-letter handling are part of the product, not later polish. Prefer structured outputs with schema validation over free-form prose when the next step is code or a tool call.

Why Specialist Agents: Assembly Line Logic

For the Why Specialist Agents Assembly stage, define the inputs, the owner of the step, and the exit criteria before changing code. Operators should be able to re-run the step from a known checkpoint without guessing hidden state. Prefer small, testable units over sprawling scripts. When a step fails, the failure should point at a single responsibility rather than a tangled pipeline. Put human approval on edges that spend money or change production data. Compile-time wiring does not equal business completeness.

Architecture at a Glance

For the Architecture at a Glance stage, define the inputs, the owner of the step, and the exit criteria before changing code. Operators should be able to re-run the step from a known checkpoint without guessing hidden state. Treat this stage as a contract between inputs and validated outputs. Name the artifacts, define success checks, and refuse silent partial completion. Put human approval on edges that spend money or change production data. Compile-time wiring does not equal business completeness. For the Architecture at a Glance stage, define the inputs, the owner of the step, and the exit criteria before changing code. Operators should be able to re-run the step from a known checkpoint without guessing hidden state. Keep configuration outside application code. Environment files, secret stores, and feature flags belong in one place operators can audit without reading the whole graph.

Use Case 1: ZQ Macro Agent

When working through the Use Case 1 ZQ stage, write down the contract first: required inputs, success signal, and what happens on partial failure. That checklist keeps later code changes honest. Document the happy path and the recovery path together. Retries, human gates, and dead-letter handling are part of the product, not later polish. Checkpoint after expensive steps. Resume should not re-bill the same LLM call when an operator retries a later node.

- Retrieve evidence for a query
CALL TESTING.ZQ_CB_AGENT.ZQ_AGENT_RETRIEVE_EVIDENCE(
 OBJECT_CONSTRUCT('QUERY', 'inflation outlook', 'CENTRAL_BANK', 'federal_reserve_system', 'K', 25)
);
 - Run full analysis (retrieval + stance + uncertainty + forward-looking)
CALL TESTING.ZQ_CB_AGENT.ZQ_AGENT_RUN_FULL_ANALYSIS(
 OBJECT_CONSTRUCT('QUERY', 'unemployment', 'CENTRAL_BANK', 'federal_reserve_system', 'K', 25)
);

Use Case 2: ZQ Equity Agent

When working through the Use Case 2 ZQ stage, write down the contract first: required inputs, success signal, and what happens on partial failure. That checklist keeps later code changes honest. Prefer small, testable units over sprawling scripts. When a step fails, the failure should point at a single responsibility rather than a tangled pipeline. Checkpoint after expensive steps. Resume should not re-bill the same LLM call when an operator retries a later node.

Evidence-Grounded Analysis: How ZQ Enforces It

When working through the Evidence-Grounded Analysis How ZQ stage, write down the contract first: required inputs, success signal, and what happens on partial failure. That checklist keeps later code changes honest. Treat this stage as a contract between inputs and validated outputs. Name the artifacts, define success checks, and refuse silent partial completion. Checkpoint after expensive steps. Resume should not re-bill the same LLM call when an operator retries a later node. When working through the Evidence-Grounded Analysis How ZQ stage, write down the contract first: required inputs, success signal, and what happens on partial failure. That checklist keeps later code changes honest. Keep configuration outside application code. Environment files, secret stores, and feature flags belong in one place operators can audit without reading the whole graph.

Code: Agent Tool Configuration

The Code Agent Tool Configuration stage works best when treated as a measurable surface. Capture one golden transcript, one failure case, and the rollback note before expanding scope. Document the happy path and the recovery path together. Retries, human gates, and dead-letter handling are part of the product, not later polish. Expose tools with narrow schemas and explicit side-effect labels. Hosts need to know which calls mutate state before they auto-approve.

# ZQ Macro Agent: tool definitions (agent_spec.py)
tools:
 - tool_spec:
 type: "generic"
 name: "retrieve_evidence"
 description: "Retrieves central bank sentences via Cortex Search and persists for NLP classification. Returns REQUEST_ID for classifier tools."
 input_schema:
 type: "object"
 properties:
 QUERY: { type: "string", description: "Search query for central bank communications" }
 CENTRAL_BANK: { type: "string", description: "Filter by central bank. NULL for all." }
 K: { type: "number", description: "Number of evidence sentences (default 25, max 200)." }
 required: [QUERY]
 - tool_spec:
 type: "generic"
 name: "classify_stance"
 description: "Classifies retrieved evidence by monetary policy stance (Hawkish/Dovish/Neutral). Requires REQUEST_ID from retrieve_evidence."
 input_schema:
 type: "object"
 properties:
 REQUEST_ID: { type: "string", description: "REQUEST_ID from retrieve_evidence" }
 required: [REQUEST_ID]

Code: Cortex Search and Evidence Persistence

The Code Cortex Search and stage works best when treated as a measurable surface. Capture one golden transcript, one failure case, and the rollback note before expanding scope. Prefer small, testable units over sprawling scripts. When a step fails, the failure should point at a single responsibility rather than a tangled pipeline. Keep graph state flat and typed. Nested blobs hide which node wrote which field and break resume after interrupts.

- Cortex Search service over CB sentences
CREATE OR REPLACE CORTEX SEARCH SERVICE TESTING.CB_AI.SENTENCE_SEARCH_SVC
 ON TEXT
 ATTRIBUTES CENTRAL_BANK, YEAR, DOCUMENT_TYPE
 WAREHOUSE = CB_AGENT_WAREHOUSE
AS
SELECT ID, TEXT, CENTRAL_BANK, YEAR, DOCUMENT_TYPE, RELEASE_DATE, …
FROM TESTING.CB_AI.SENTENCE_SEARCH_VW;
 - Evidence and labels tables for traceability
CREATE TABLE TESTING.CB_AI.EVIDENCE_HITS (
 request_id STRING, hit_id STRING, rank INT,
 document_id STRING, sentence_id STRING, text STRING, …
);
CREATE TABLE TESTING.CB_AI.MODEL_LABELS (
 request_id STRING, model_id STRING, hit_id STRING,
 prediction STRING, confidence DOUBLE, …
);

The Pipeline: Retrieval → Classification → Aggregation

The The Pipeline Retrieval Classification stage works best when treated as a measurable surface. Capture one golden transcript, one failure case, and the rollback note before expanding scope. Treat this stage as a contract between inputs and validated outputs. Name the artifacts, define success checks, and refuse silent partial completion. Separate chunking policy from retrieval policy. Changing one should not force a rewrite of the other when quality metrics move. The The Pipeline Retrieval Classification stage works best when treated as a measurable surface. Capture one golden transcript, one failure case, and the rollback note before expanding scope. Keep configuration outside application code. Environment files, secret stores, and feature flags belong in one place operators can audit without reading the whole graph.

Conclusion

For the Conclusion stage, define the inputs, the owner of the step, and the exit criteria before changing code. Operators should be able to re-run the step from a known checkpoint without guessing hidden state. Document the happy path and the recovery path together. Retries, human gates, and dead-letter handling are part of the product, not later polish. Put human approval on edges that spend money or change production data. Compile-time wiring does not equal business completeness.

References

For the References stage, define the inputs, the owner of the step, and the exit criteria before changing code. Operators should be able to re-run the step from a known checkpoint without guessing hidden state. Prefer small, testable units over sprawling scripts. When a step fails, the failure should point at a single responsibility rather than a tangled pipeline. Put human approval on edges that spend money or change production data. Compile-time wiring does not equal business completeness.

Operational checklist

When working through the Operational checklist stage, write down the contract first: required inputs, success signal, and what happens on partial failure. That checklist keeps later code changes honest.

Record timings and token or query cost next to functional results. Cost visibility early prevents surprise bills when the path moves from demo to shared environments.

Checkpoint after expensive steps. Resume should not re-bill the same LLM call when an operator retries a later node.

Pin dependency versions and record the image digest that ran the demo. Reproducibility beats tribal knowledge.

Keep configuration outside application code. Environment files, secret stores, and feature flags belong in one place operators can audit without reading the whole graph.

Checkpoint after expensive steps. Resume should not re-bill the same LLM call when an operator retries a later node.

Before promoting the stack, freeze versions, capture a golden transcript for the critical path, and confirm rollback steps. Shared environments need rate limits, tenancy checks, and a clear owner for secret rotation. Prefer boring reliability over clever one-off demos.

Batch note for b3ca06f8cc84: keep provider keys out of the repo, set a per-session token ceiling, and store transcripts next to the eval fixtures so later model swaps stay comparable.