skills/codex/databricks-model-serving/SKILL.md
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: databricks-model-serving --- # Databricks Model Serving Deploy MLflow models and AI agents to scalable REST API endpoints. ## Quick Decision: What Are You Deploying? | Model Type | Pattern | Reference | | ----------------------------------------- | --------------------------- | ---------------------------------------- | | **Traditional ML** (sk
npx skillsauth add frank-luongt/faos-skills-marketplace skills/codex/databricks-model-servingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Deploy MLflow models and AI agents to scalable REST API endpoints.
| Model Type | Pattern | Reference |
| ----------------------------------------- | --------------------------- | ---------------------------------------- |
| Traditional ML (sklearn, xgboost) | mlflow.sklearn.autolog() | 1-classical-ml.md |
| Custom Python model | mlflow.pyfunc.PythonModel | 2-custom-pyfunc.md |
| GenAI Agent (LangGraph, tool-calling) | ResponsesAgent | 3-genai-agents.md |
| Topic | File | When to Read | | ---------------------- | ------------------------------------------------------ | -------------------------------- | | Classical ML | 1-classical-ml.md | sklearn, xgboost, autolog | | Custom PyFunc | 2-custom-pyfunc.md | Custom preprocessing, signatures | | GenAI Agents | 3-genai-agents.md | ResponsesAgent, LangGraph | | Tools Integration | 4-tools-integration.md | UC Functions, Vector Search | | Development & Testing | 5-development-testing.md | MCP workflow, iteration | | Logging & Registration | 6-logging-registration.md | mlflow.pyfunc.log_model | | Deployment | 7-deployment.md | Job-based async deployment | | Querying Endpoints | 8-querying-endpoints.md | SDK, REST, MCP tools | | Package Requirements | 9-package-requirements.md | DBR versions, pip |
%pip install -U mlflow==3.6.0 databricks-langchain langgraph==0.3.4 databricks-agents pydantic
dbutils.library.restartPython()
Or via MCP:
execute_databricks_command(code="%pip install -U mlflow==3.6.0 databricks-langchain langgraph==0.3.4 databricks-agents pydantic")
Create agent.py locally with ResponsesAgent pattern (see
3-genai-agents.md).
upload_folder(
local_folder="./my_agent",
workspace_folder="/Workspace/Users/[email protected]/my_agent"
)
run_python_file_on_databricks(
file_path="./my_agent/test_agent.py",
cluster_id="<cluster_id>"
)
run_python_file_on_databricks(
file_path="./my_agent/log_model.py",
cluster_id="<cluster_id>"
)
See 7-deployment.md for job-based deployment that doesn't timeout.
query_serving_endpoint(
name="my-agent-endpoint",
messages=[{"role": "user", "content": "Hello!"}]
)
import mlflow
import mlflow.sklearn
from sklearn.linear_model import LogisticRegression
# Enable autolog with auto-registration
mlflow.sklearn.autolog(
log_input_examples=True,
registered_model_name="main.models.my_classifier"
)
# Train - model is logged and registered automatically
model = LogisticRegression()
model.fit(X_train, y_train)
Then deploy via UI or SDK. See 1-classical-ml.md.
If MCP tools are not available, use the SDK/CLI examples in the reference files below.
| Tool | Purpose |
| ------------------------------- | ------------------------------- |
| upload_folder | Upload agent files to workspace |
| run_python_file_on_databricks | Test agent, log model |
| execute_databricks_command | Install packages, quick tests |
| Tool | Purpose |
| ------------- | -------------------------------- |
| create_job | Create deployment job (one-time) |
| run_job_now | Kick off deployment (async) |
| get_run | Check deployment job status |
| Tool | Purpose |
| ----------------------------- | -------------------------- |
| get_serving_endpoint_status | Check if endpoint is READY |
| query_serving_endpoint | Send requests to endpoint |
| list_serving_endpoints | List all endpoints |
get_serving_endpoint_status(name="my-agent-endpoint")
Returns:
{
"name": "my-agent-endpoint",
"state": "READY",
"served_entities": [...]
}
query_serving_endpoint(
name="my-agent-endpoint",
messages=[
{"role": "user", "content": "What is Databricks?"}
],
max_tokens=500
)
query_serving_endpoint(
name="sklearn-classifier",
dataframe_records=[
{"age": 25, "income": 50000, "credit_score": 720}
]
)
| Issue | Solution |
| -------------------------- | -------------------------------------------------------------------- |
| Invalid output format | Use self.create_text_output_item(text, id) - NOT raw dicts! |
| Endpoint NOT_READY | Deployment takes ~15 min. Use get_serving_endpoint_status to poll. |
| Package not found | Specify exact versions in pip_requirements when logging model |
| Tool timeout | Use job-based deployment, not synchronous calls |
| Auth error on endpoint | Ensure resources specified in log_model for auto passthrough |
| Model not found | Check Unity Catalog path: catalog.schema.model_name |
WRONG - raw dicts don't work:
return ResponsesAgentResponse(output=[{"role": "assistant", "content": "..."}])
CORRECT - use helper methods:
return ResponsesAgentResponse(
output=[self.create_text_output_item(text="...", id="msg_1")]
)
Available helper methods:
self.create_text_output_item(text, id) - text responsesself.create_function_call_item(id, call_id, name, arguments) - tool callsself.create_function_call_output_item(call_id, output) - tool resultsdevelopment
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: grpo-rl-training description: GRPO reinforcement learning training with TRL. Use when applying Group Relative Policy Optimization for reasoning and task-specific model training. --- # GRPO/RL Training with TRL Expert-level guidance for implementing Group Relative Policy Optimization (GRPO) using the Transformer Reinforcement Learning (TRL) library. This skill provides battle-tested patterns, critical insights, and production-r
tools
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: graphql-architect description: Master modern GraphQL with federation, performance optimization, --- ## Use this skill when - Working on graphql architect tasks or workflows - Needing guidance, best practices, or checklists for graphql architect ## Do not use this skill when - The task is unrelated to graphql architect - You need a different domain or tool outside this scope ## Instructions - Clarify goals, constraints, and
development
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: grafana-dashboards description: Create and manage production Grafana dashboards for real-time visualization of system and application metrics. Use when building monitoring dashboards, visualizing metrics, or creating operational observability interfaces. --- # Grafana Dashboards Create and manage production-ready Grafana dashboards for comprehensive system observability. ## Do not use this skill when - The task is unrelated
development
<!-- AUTO-GENERATED by export-skills.py — DO NOT EDIT --> --- name: gptq description: GPTQ post-training quantization for generative models. Use when quantizing large models to 4-bit with calibration-based weight compression. --- # GPTQ (Generative Pre-trained Transformer Quantization) Post-training quantization method that compresses LLMs to 4-bit with minimal accuracy loss using group-wise quantization. ## When to use GPTQ **Use GPTQ when:** - Need to fit large models (70B+) on limited GPU