Betas
Pass a beta option to Claude on Vertex AI and inspect the SDK’s known beta names.
This example forwards a beta option with betas. The SDK’s list contains names known to that installed SDK across platforms; it is not a live inventory of features enabled for your Vertex AI model or region.
Setting the context-management beta alone does not demonstrate context editing. This recipe has no context_management edit configuration or growing conversation to clear. See the context-editing requirements before adding that behavior.
The source uses claude-sonnet-4@20250514, which Anthropic lists as deprecated on Google Cloud. Google's Sonnet 4 card does not establish a completed retirement. For a new deployment, choose a current model and its supported settings, such as Sonnet 4.6. Provider availability and lifecycle dates can differ from the direct Anthropic API.
"""Example demonstrating how to use Anthropic beta features.
Beta features are experimental capability extensions for Anthropic models.
You can use them with the `betas` parameter of the Agno Claude model class.
"""
import anthropic
from agno.agent import Agent
from agno.models.vertexai.claude import Claude
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
# Setup the beta features we want to use
betas = ["context-management-2025-06-27"]
model = Claude(id="claude-sonnet-4@20250514", betas=betas)
# Note: you can see all beta features available in your Anthropic version like this:
all_betas = anthropic.types.AnthropicBetaParam
agent = Agent(model=model)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
# The beta features are now activated, the model will have access to use them.
if __name__ == "__main__":
print("\n=== All available Anthropic beta features ===")
beta_lines = "\n- ".join(str(b) for b in all_betas.__args__[1].__args__)
print(f"- {beta_lines}")
print("=============================================\n")
print(
"Note: Not all beta features are available across all inference providers. Read more here: https://platform.claude.com/docs/en/api/overview"
)
agent.print_response(
"My name is John Doe and I live in New York City. I like to bike and hike in the Catskill Mountains."
)Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno "anthropic[vertex]"Set up Google Cloud access
Use a project with billing and aiplatform.googleapis.com enabled, enable the chosen Claude model in Model Garden, and give your calling identity permission to use it. Follow Google's Claude setup guide. Install the Google Cloud CLI for the local sign-in command below.
Set the project and a location supported by your model. us-east5 is a supported example for Sonnet 4 and Sonnet 4.6; check the model's current availability before switching models or locations.
export ANTHROPIC_VERTEX_PROJECT_ID="your-project-id"
export CLOUD_ML_REGION="us-east5"Authenticate locally with Application Default Credentials:
gcloud auth application-default loginADC supplies credentials; it does not enable models or grant IAM permissions. These examples authenticate to Google Cloud without an Anthropic API key.
Run the example
Save the code above as betas.py, then run:
python betas.pyFull source: cookbook/90_models/vertexai/claude/betas.py