Skip to content
Lucas Lessa
Voltar para as notícias
DatabricksBetaImpacto: Médio

Use request tags in Unity Gateway service policies

Custom policies in Unity Gateway can now check request tags sent via headers to control model requests and MCP tool calls.

O que mudou

Use cases

Imagine you need to ensure that calls to an AI model or MCP tool include a valid project identifier before proceeding. With this feature, you can inspect caller-supplied tags directly within SQL-based service policies.

  • Validate project or cost center tags before executing a model or tool.
  • Block requests that lack required metadata tags.
  • Enforce governance rules based on request context.

How to use

Use the Unity Gateway to create a SQL UDF that evaluates the event object and returns an access decision.

CREATE OR REPLACE FUNCTION my_catalog.my_schema.my_policy(
  event VARIANT
)
RETURNS VARIANT
LANGUAGE SQL
RETURN CASE 
  WHEN event:context.request_tags.project::string IS NULL THEN 
    to_variant_object(named_struct('result', 'DENY', 'reason', 'Required project tag is missing.'))
  ELSE 
    to_variant_object(named_struct('result', 'ALLOW', 'reason', 'Access permitted.'))
END;

What happens in this code:

  1. The UDF function receives the event argument of type VARIANT carrying the request context.
  2. The path event:context.request_tags.project extracts the tag sent in the Databricks-Ai-Gateway-Request-Tags HTTP header.
  3. The conditional evaluates if the tag is present and returns a structured decision object using to_variant_object containing ALLOW or DENY.

Limitations and requirements

  • This feature is in Beta.
  • Applies to Model Services, Model Provider Services, and MCP tool calls (tools/call).
  • The combined decoded size of keys and values is limited to 10 KiB of UTF-8 data.
  • Account admins must enable this feature from the account console Previews page.
Ver nota oficial do Databricks

Use request tags in Unity Gateway service policies (Beta)

Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.

Relacionadas