Skip to content

feat: add use-supervisor-api skill#155

Open
smurching wants to merge 6 commits intodatabricks:mainfrom
smurching:agent-supervisor-api
Open

feat: add use-supervisor-api skill#155
smurching wants to merge 6 commits intodatabricks:mainfrom
smurching:agent-supervisor-api

Conversation

@smurching
Copy link
Copy Markdown
Collaborator

@smurching smurching commented Mar 11, 2026

Summary

  • Adds a use-supervisor-api skill that guides users to build agents using the Databricks Supervisor API
  • The skill covers: installing databricks-openai, declaring hosted tools (Genie spaces, UC functions, agent endpoints, MCP servers), updating agent_server/agent.py to call
    DatabricksOpenAI().responses.create(), granting resource permissions in databricks.yml, and beta limitations
  • Skill is synced to all existing templates via sync-skills.py

What is the Supervisor API

The Supervisor API (POST https://{workspace_id}.ai-gateway.{domain}/mlflow/v1/responses) lets Databricks run the tool-selection and synthesis loop server-side. Users declare hosted
tools and call responses.create() — no agent loop code needed.

Currently in Beta — requires AI Gateway (Beta) preview enabled in the workspace.

Beta limitations noted in skill

  • Usage tracking is not supported
  • Cannot mix hosted tools with client-side function tools in the same request
  • Inference parameters (e.g., temperature) are not supported when tools are passed

Test plan

  • Skill appears in all template .claude/skills/ directories after running uv run python .scripts/sync-skills.py

smurching and others added 2 commits March 10, 2026 21:31
Adds a new app template that uses the Databricks Supervisor API
(AI Gateway at /mlflow/v1/responses) for server-side tool execution,
instead of managing an agent loop with the OpenAI Agents SDK.

Key implementation detail: DatabricksOpenAI defaults to
{host}/serving-endpoints, but the Supervisor API is at
{host}/mlflow/v1/responses. _get_client() overrides base_url to
point to the correct AI Gateway endpoint.

Includes unit tests (9 passing) and integration test stubs for the
live staging endpoint.

Signed-off-by: Sid Murching <sid.murching@databricks.com>
- Derive AI Gateway base URL from workspace ID + domain (not workspace host)
  e.g. https://<workspace_id>.ai-gateway.<domain>/mlflow/v1
- Add liteswap staging header via extra_headers per-call
- Fix output serialization: call .model_dump() on each response.output item
- Swap example tool to Genie (NYC taxi space) to demonstrate hosted tools
- Update MODEL to databricks-claude-opus-4-6
- Add unit tests for _ai_gateway_base_url, _get_client, invoke/stream handlers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@smurching smurching changed the title feat: add agent-supervisor-api template feat: add use-supervisor-api skill Mar 16, 2026
smurching and others added 3 commits March 15, 2026 22:22
Adds a skill that guides users to build agents using the Databricks
Supervisor API (hosted tools) instead of a client-side agent loop.
Syncs the skill to all existing templates.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tern

- Replace manual AI Gateway URL derivation with use_ai_gateway=True
- Add OBO pattern: cache base URL at startup, create per-request client
  with forwarded user token via x-forwarded-access-token custom_input
- Bump minimum databricks-openai version to 0.14.0
- Drop beta/workspace availability caveats; keep real API constraints

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sor-api skill

The agent_endpoint tool type routes through KATool which always sends
ka_query as the input parameter — a KA-specific protocol. Regular
LangGraph/OpenAI agents don't implement this protocol and will fail.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@smurching smurching requested a review from jennsun March 23, 2026 20:32
- genie -> genie_space (drop name field)
- uc_function -> unity_catalog_function (drop name_alias)
- mcp -> external_mcp_server (drop name field)
- Update permissions table and troubleshooting section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| `unity_catalog_function` | `uc_securable` (FUNCTION) with `EXECUTE` |
| `agent_endpoint` | `serving_endpoint` with `CAN_QUERY` (KA endpoints only) |
| `external_mcp_server` | `uc_securable` (CONNECTION) with `USE_CONNECTION` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update these to correspond with the latest:

Here is the **complete, up-to-date list** of all tool types supported by the Supervisor API (`POST /api/2.0/mas/responses`), based on the current codebase:

## Allowlisted tool types (via `/responses` endpoint)

These are the tool types accepted by `_validate_responses_tool_types()` — the default allowlist in `_RESPONSES_DEFAULT_ALLOWED_TOOL_TYPES`:

| # | Tool type (as sent in `tools[].type`) | Description |
|---|---|---|
| 1 | **`genie_space`** | Genie AI/BI space — queries a Genie room by `space_id` |
| 2 | **`serving_endpoint`** | Serving endpoint (e.g., Knowledge Agent) — calls a model serving endpoint |
| 3 | **`unity_catalog_function`** | Unity Catalog function — executes a UC function by its 3-level path |
| 4 | **`external_mcp_server`** | External MCP server via UC connection — connects to an MCP server through a UC connection name |
| 5 | **`databricks_apps_mcp`** | Databricks Apps MCP — connects to an MCP server hosted as a Databricks App |
| 6 | **`code_interpreter`** | Code interpreter — executes Python code in a sandboxed REPL |

## Additional tool types (handled in code but not in the `/responses` allowlist by default)

These are processed by `_build_supervisor_conf_from_openai_format()` but are gated behind the `databricks.tiles.mas.enabledTools` Safe flag or used internally:

| # | Tool type | Description |
|---|---|---|
| 7 | **`function`** | Client-defined function tools (OpenAI-compatible) — always allowed, passed to the LLM as callable functions |
| 8 | **`agent`** | Sub-agent tool — delegates to another agent |
| 9 | **`vector_search`** | Vector search index — searches a Databricks vector search index (internal, stored in `request_context`) |
| 10 | **`iretriever`** | Instructed retriever — semantic document retrieval with knowledge sources (internal, stored in `request_context`) |

## Alias mapping

The codebase also accepts **alternative names** for some tool types via `_TOOL_TYPE_ALIASES`. These are Supervisor Agent naming conventions that map to the internal MAS names:

| Alias (what you can send) | Maps to internally |
|---|---|
| `genie_space` | `genie` |
| `serving_endpoint` | `agent_endpoint` |
| `unity_catalog_function` | `uc_function` |
| `external_mcp_server` | `mcp` |
| `databricks_apps_mcp` | `mcp` |

So for example, sending `type: "genie_space"` or `type: "genie"` both work — the alias is resolved before processing.

## Connector shorthands (sub-type of `external_mcp_server` / `mcp`)

When using `external_mcp_server` or `mcp` tool type, you can specify a `connector` shorthand instead of a `connection_name`. These auto-create system-managed UC connections:

| Connector shorthand | Service | Has built-in MCP server? |
|---|---|---|
| `google_drive` | Google Drive | Yes (uses internal MAS adapter) |
| `sharepoint` | SharePoint | Yes (uses internal MAS adapter) |
| `github_mcp` | GitHub | No (uses external MCP proxy) |
| `atlassian_mcp` | Atlassian (Jira/Confluence) | No (uses external MCP proxy) |

---

So your table should be updated to:

| Tool type | Resource to grant |
|-----------|-------------------|
| `genie_space` | `genie_space` with `CAN_RUN` |
| `unity_catalog_function` | `uc_securable` (FUNCTION) with `EXECUTE` |
| `serving_endpoint` | `serving_endpoint` with `CAN_QUERY` (KA endpoints only) |
| `external_mcp_server` | `uc_securable` (CONNECTION) with `USE_CONNECTION` |
| `databricks_apps_mcp` | *(Databricks App access)* |
| `code_interpreter` | *(no external resource — sandboxed REPL)* |
| `function` | *(client-side — no server resource)* |
| `agent` | *(sub-agent delegation)* |
| `vector_search` | *(vector search index access)* |
| `iretriever` | *(instructed retriever — knowledge sources)* |

@jennsun
Copy link
Copy Markdown
Contributor

jennsun commented Apr 13, 2026

taking over this pr: #183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants