Agent Framework
For more details see Databricks Agent Framework
- databricks.agents.deploy(model_name: str, model_version: int, scale_to_zero: bool = False, environment_vars: Dict[str, str] | None = None, instance_profile_arn: str | None = None, tags: Dict[str, str] | None = None, workload_size: ServedModelInputWorkloadSize = ServedModelInputWorkloadSize.SMALL, **kwargs) Deployment
Deploy new version of the agents.
- Parameters:
model_name – Name of the UC registered model.
model_version – Model version number.
scale_to_zero – Flag to scale the endpoint to zero when not in use. With scale to zero, the compute resources may take time to come up so the app may not be ready instantly. Defaults to False.
environment_vars – Dictionary of environment variables used to provide configuration for the endpoint. Defaults to {}.
instance_profile_arn – Instance profile ARN to use for the endpoint. Defaults to None.
tags – Dictionary of tags to attach to the deployment. Defaults to None.
- Returns:
Chain deployment metadata.
- databricks.agents.get_deployments(model_name: str, model_version: int | None = None) List[Deployment]
Get chain deployments metadata.
- Parameters:
model_name – Name of the UC registered model
model_version – (Optional) Version numbers for specific agents.
- Returns:
All deployments for the UC registered model.
- databricks.agents.delete_deployment(model_name: str, model_version: int | None = None) None
Delete an agent deployment.
- Parameters:
model_name – Name of UC registered model
version – Model version number. This is optional and when specified, we delete the served model for the particular version.
- databricks.agents.set_permissions(model_name: str, users: List[str], permission_level: PermissionLevel)
Set permissions to use chat and review apps.
- Parameters:
model_name – Name of the UC registered model.
users – List of account user emails or groups.
permission_level –
Permissions level assigned to the list of users. Supported permission levels are:
NO_PERMISSIONS
: chat and review privileges revoked for usersCAN_VIEW
: users can list and get metadata for deployed agentsCAN_QUERY
: users can use chat with the agent and provide feedback on their own chatsCAN_REVIEW
: users can provide feedback on review tracesCAN_MANAGE
: users can update existing agent deployments and deploy agents.
- databricks.agents.get_permissions(model_name: str) List[Tuple[str, PermissionLevel]]
Compute combined minimum permissions for endpoints and experiments associated with a model.
- databricks.agents.enable_trace_reviews(model_name: str, request_ids: List[str] | None = None) str
Enable the reviewer UI to collect feedback on the conversations from the endpoint inference log.
- Parameters:
model_name – The name of the UC Registered Model to use when registering the chain as a UC Model Version. Example: catalog.schema.model_name
request_ids – Optional list of request_ids for which the feedback needs to be captured.
- Returns:
URL for the reviewer UI where users can start providing feedback
Example:
from databricks.agents import enable_trace_reviews enable_trace_reviews( model_name="catalog.schema.chain_model", request_ids=["490cf09b-6da6-474f-bc35-ee5ca688ff8", "a4d37810-5cd0-4cbd-aa25-e5ceaf6a448"], )
- databricks.agents.set_review_instructions(model_name: str, instructions: str) None
Set the instructions for the review UI.
- Parameters:
model_name – The name of the UC Registered Model to use when registering the chain as a UC Model Version.
instructions – Instructions for the reviewer UI in markdown format.
Example:
from databricks.agents import set_review_instructions set_review_instructions( model_name="catalog.schema.chain_model", instructions="Please provide feedback on the conversations based on your knowledge of UC." )
- databricks.agents.get_review_instructions(model_name: str) str
Get the instructions for the review UI.
Args: model_name: The name of the UC Registered Model to use when
registering the chain as a UC Model Version. Example: catalog.schema.model_name
- Returns:
Instructions for the reviewer UI in markdown format
Example:
from databricks.agents import get_review_instructions instructions = get_review_instructions(model_name="catalog.schema.chain_model") print(instructions)
- class databricks.agents.PermissionLevel(value)
Bases:
Enum
Permission level for chat and review apps.
- NO_PERMISSIONS = (1, 'Users have no chat and review privileges.')
- CAN_VIEW = (2, 'Users can list and get metadata for deployed agents.')
- CAN_QUERY = (3, 'Users can use chat with the agent and provide feedback on their own chats.')
- CAN_REVIEW = (4, 'Users can provide feedback on review traces.')
- CAN_MANAGE = (5, 'Users can update existing agent deployments and deploy agents.')