Agent Deployment And Evaluation

How do you evaluate an AI agent before and after deployment?


  • Evaluation is continuous: test before release, then monitor real usage, regressions, latency, cost, and quality after release.
  • MLflow Tracing records the execution path: user input, model output, tool calls, retrieved documents, intermediate results, errors, and timing. Use traces to diagnose why an answer was produced.
  • MLflow Tracking/logging records experiments, parameters, code/artifacts, model versions, evaluation results, and metrics for reproducibility and auditability.
  • LLM-as-a-judge uses an evaluator model to score criteria such as correctness, groundedness, relevance, or tool use; judges can be imperfect, so calibrate against human-reviewed examples.
  • Human feedback supplies domain expertise and identifies harmful, misleading, or unhelpful answers; capture examples as future regression tests.
  • Synthetic evaluation datasets generate representative questions and expected outcomes faster, but must be checked for realism and bias. Include edge cases, ambiguous questions, failed retrieval, and tool errors.
  • Compare evaluation results against explicit acceptance criteria; a single pass rate is not sufficient to prove production readiness.

How do you export an AI Playground agent into deployable code?


  • In AI Playground, open your tool-enabled prototype and choose Get code → Create agent notebook.
  • Inspect the generated driver notebook and agent.py rather than deploying blindly. The generated agent uses MLflow’s ResponsesAgent interface for requests and responses.
  • Update the example test prompt to Can you tell me the policy for exchanging items?.
  • Set the registration destination to catalog dbacademy, schema get_started_agents, and model name my_first_agent.
  • In the generated deployment call, set scale_to_zero=True when appropriate for Free Edition limits and cost control; exact arguments depend on the generated notebook and installed SDK version.
  • Run the notebook cells in order to install dependencies, instantiate the agent, test predict and predict_stream, run evaluations, register the model, and deploy it.
  • Confirm the registered Unity Catalog model is dbacademy.get_started_agents.my_first_agent, then check Serving until the endpoint is Ready. The example endpoint name is agents_dbacademy-get_started_agents-my_first_agent.
  • Examine the MLflow traces and evaluation outputs for correct tool selection, responses, failures, and latency before considering the deployment successful.

How do batch, streaming, and real-time deployment differ?


  • Batch inference: process many records together on a schedule; good for offline scoring and high-throughput jobs where immediate responses are unnecessary.
  • Streaming inference: process incoming events continuously or in micro-batches; useful for near-real-time data processing.
  • Real-time serving: respond to individual requests with low latency; the usual choice for interactive chat agents.
  • Mosaic AI Model Serving exposes agents and models through managed endpoints, APIs, and UI tooling, with scalability, access controls, and observability.
  • Serving can support custom agents, Databricks-hosted models, and externally hosted models, subject to endpoint type and workspace capabilities.
  • Production readiness also requires security, cost budgets, rate limits, error handling, monitoring, and a rollback strategy.

How do you test and call a deployed agent?


  • Open Serving and select agents_dbacademy-get_started_agents-my_first_agent; wait until its status is Ready.
  • Click Use to open the endpoint in AI Playground. Ask for the order history of ronald54@example.net and verify a call to get_service_history.
  • Ask about the exchange policy and verify a call to get_return_policy; inspect the tool traces rather than relying on a plausible final answer.
  • A scaled-to-zero endpoint may need roughly 30 seconds or longer to warm up; allow for cold-start latency and possible timeouts.
  • For SQL integrations, Databricks supports ai_query() to invoke supported serving endpoints. The input and response shape depend on the endpoint’s schema; a custom ResponsesAgent may require a structured request, not just a plain string. Inspect the endpoint’s Use / Query example before adapting SQL.
  • Illustrative pattern for a compatible text-input endpoint (not guaranteed for a ResponsesAgent):
SELECT ai_query('my-serving-endpoint', 'Summarize the exchange policy') AS response;
  • For a custom agent, follow the endpoint’s generated request JSON and any ai_query() support requirements. Applications can also call the Model Serving REST API or SDK with authenticated credentials; never hard-code tokens in notebooks.

How do you build and validate structured and unstructured agent tools?


  • Structured tool: define a governed Unity Catalog SQL function such as get_customer_interactions(customer_email) to retrieve recent customer service records from dbacademy.get_started_agents.cust_service_data.
  • Inspect the actual source table’s column names first. Use a parameterized filter on the email field, order by the correct timestamp, and limit the returned records to avoid unnecessary data exposure.
  • Test the function in SQL with the lab’s example address:
SELECT dbacademy.get_started_agents.get_customer_interactions(
  'nicolas.pelaez@example.com'
);
  • Unstructured tool: create search_product_docs(search_query) to retrieve relevant product passages from the Vector Search index dbacademy.get_started_agents.product_docs_index (or the exact index name created during setup).
  • Test semantic retrieval with bluetooth headphone connection. Use the installed course notebook’s vector_search() and/or ai_query() syntax, verifying index name, arguments, output columns, and function availability in your workspace.
  • Register and grant access to the functions in Unity Catalog; add both as hosted Unity Catalog tools to a tools-enabled model in AI Playground.
  • Try a return-support conversation; when prompted, provide nicolas.pelaez@example.com and bluetooth headphone. Inspect whether the agent selects the correct tool, passes the right arguments, and accurately summarizes the returned information.
  • Avoid inventing function SQL against unknown schemas: first run DESCRIBE TABLE dbacademy.get_started_agents.cust_service_data and inspect the Vector Search index configuration, then fill in the lab’s FILL_IN markers accordingly.

What should you check before allowing production users to access an agent?


  • Correctness: representative test questions, grounded responses, appropriate tool calls, and human-reviewed failures.
  • Security: least-privilege Unity Catalog permissions, scoped tool access, secrets management, prompt-injection defenses, and protection of customer data.
  • Reliability: handling of unavailable tools, timeouts, retries, cold starts, and malformed inputs.
  • Operations: endpoint readiness, traffic and latency metrics, cost and token usage, versioning, rollback, and audit logs.
  • Ongoing improvement: MLflow traces, evaluation runs, human feedback, review workflows, and monitoring for quality drift.
  • Free Edition quotas and supported features can change; verify current endpoint and resource limits before deploying.

Where can you find official documentation?