Skip to main content
Model policies allow for the coordination of multiple models to accomplish tasks like load-balancing and fallback.

Adding model policies

BASH
orchestrate models policy add --name <model_name> --model <provider1>/<model_id1> --model <provider2>/<model_id2> --strategy <strategy_type> --strategy-on-code 500 --retry-on-code 503 --retry-attempts 3

Importing model policies

BASH
orchestrate models policy import --file my_spec.yaml
After you create a model policy, assign the policy to your agent by using the ADK and the agent YAML file. Assign the policy the same way that you assign a regular model. You cannot assign a model policy to a Generative Prompt Activity in a flow.
Where the my_spec.yaml file follows this structure:
[my_spec.yaml]
spec_version: v1
kind: model
name: anygem
description: Balances requests between 2 Gemini models
display_name: Any Gem
policy:
  strategy:
    mode: loadbalance
    on_status_codes: [503, 504]
  retry:
    attempts: 1
  targets:
    - model_name: virtual-model/google/gemini-2.0-flash
      weight: 0.75   # Weights must be greater than 0 and less than or equal to 1
    - model_name: virtual-model/google/gemini-2.0-flash-lite
      weight: 0.25
Flags:
  • --file (-f): File path of the spec file containing the model policy configuration.

Updating model policy

Use either the add or import commands with the name of the model policy that you want to update to update the model policy.

Exporting model policy

BASH
orchestrate models policy export -n <model_name> -o <path>.zip

Removing model policies

BASH
orchestrate models policy remove -n <name of policy>