Agents & Process Automation 101 was the why and Levels of Autonomy (LoA) for Enterprise Automation was the dial, this is the wiring you can ship, now tightened to match how you’ll actually deploy: one generic agent, SOP packaged with each model version, and the caller chooses the version (e.g., @Champion/@Challenger or separate endpoints). Tools are Unity Catalog (UC) functions only. Policy lives in YAML. We finish with a standardised Assurance Gate and real telemetry.
- Agent ≠ SOP: Ship one generic agent; each model version bundles its SOP. Caller picks the version (alias/endpoint).
- Tools = UC functions: Reads → UC SQL FUNCTION. Actions → Model-as-Function (MLflow pyfunc + Serving). The agent never calls raw APIs or MCP directly.
- Planner on rails: LLM plans one step at a time using only allow-listed UC tools from the SOP, executes, observes, reflects.
- Guardrails without extra boxes: Structure/PII via UC FUNCTIONS; policy thresholds as CEL expressions inside the SOP.
- Assurance Gate: Verify (UC) → policy (CEL) → MLflow judges (groundedness/relevance/safety) → auto-finalize or HITL.
- Ops that scale: MLflow Tracing → OpenTelemetry; aliases for Champion/Challenger rollout; clean lineage because SOP is versioned with the model.
agent/sop_agent_langchain.py: Generic LangChain agent that reads an SOP YAML, builds UC-backed tools, runs, and applies the Assurance Gate (UC guardrail → CEL → MLflow judges).register/register_agent_langchain_uc.py: Registers the agent as an MLflow model in UC; the SOP path is tagged and bundled with the version.invoke/invoke_champion.py: Small CLI to invoke the registered model (@Championby default).sop.yaml: Example SOP with planner config, UC tools, guardrails, failure policy, and judging rubric.sql/uc_functions.sql: Example UC SQL FUNCTIONS for lookup/recall/validation.
- Python 3.11+
uvfor environment management (brew install uvor seehttps://astral.sh/uv)- Databricks workspace with UC and Model Registry
- SQL Warehouse credentials and a serving endpoint for model tools
uv sync --python 3.11
# activate
source .venv/bin/activate # zsh/bash
# or
source .venv/bin/activate.fish # fishSet these environment variables:
MLFLOW_REGISTRY_URI=databricks-uc(default in registrar)DB_HOST— workspace hostnameDB_WAREHOUSE— SQL warehouse HTTP pathDB_TOKEN— Personal Access Token/Service Principal for SQLDATABRICKS_TOKEN— Token used by the planner and model-serving calls
python -m register.register_agent_langchain_uc \
# defaults: model_name=procure.platform.agent, alias omittedEdit register/register_agent_langchain_uc.py to set sop_path and (optionally) alias (e.g., Champion). The registrar logs a LangChain model, pins/bundles the SOP, and (if set) assigns an alias.
# invoke Champion by default
python invoke/invoke_champion.py --company-name "ACME Ltd" --amount 750 --pretty
# or provide the model URI and JSON payload
python invoke/invoke_champion.py \
--model-uri "models:/procure.platform.agent@Challenger" \
--input-json '{"company_name":"ACME Ltd","amount":750}' --prettyThe SOP controls the planner and the available tools and policies:
- planner: model/base_url/temperature/max_steps and the system prompt
- tools: allow-listed UC tools with JSON Schemas for arguments
kind: sql_function→uc_fn: "catalog.schema.fn"kind: model_function→uc_model+uc_endpoint(Serving)
- guardrails: UC FUNCTIONS for structural checks + CEL gates for policy
- failure: max retries/backoff and retryability per tool
- judging: pass threshold and rubric for MLflow judges
See sop.yaml for a working example.
- SQL reads: implement as UC SQL FUNCTIONs (see
sql/uc_functions.sql). - Actions: publish an MLflow pyfunc and expose via Databricks Model Serving; reference it with
uc_modelanduc_endpointin the SOP.
Executed after the agent’s tool run(s):
- Validate structure/PII with UC FUNCTIONS (
uc_validate_payload) - CEL policy decisions (
allow/fail_and_retry/require_hitl) - MLflow judges compute groundedness, relevance, safety → score + verdict
If policy fails or judges fail, the chain returns REQUIRES_HITL; otherwise COMPLETED with a confidence score.
- Use MLflow Tracing and export to OpenTelemetry (see SOP
observabilityfields) - SOP is bundled with each model version → clean lineage and reproducibility
- Import errors: run commands from the repo root or execute modules, e.g.
python -m register.register_agent_langchain_uc. - Authentication: ensure
DB_TOKENandDATABRICKS_TOKENare set and valid. - Model URI: confirm the model is registered in UC and the alias (e.g.,
Champion) exists.
- Agents & Process Automation 101 — the why: LinkedIn
- Levels of Autonomy (LoA) for Enterprise Automation — the dial: LinkedIn
Licensed under the Apache License, Version 2.0. See the LICENSE file for details.