IBM WatsonX

Use IBM WatsonX foundation models with Agno agents.

IBM WatsonX provides access to foundation models through IBM's cloud platform.

See all the IBM WatsonX supported models here.

Set an explicit model ID available in your watsonx region and project. The examples use meta-llama/llama-3-3-70b-instruct for text and mistralai/mistral-small-3-1-24b-instruct-2503 for images; check regional availability.

The adapter's default remains ibm/granite-20b-code-instruct, withdrawn from the multitenant service on July 17, 2025. The old Llama 3.2 11B Vision model was withdrawn on August 8, 2026. Dedicated deployments have a separate lifecycle; consult IBM's model lifecycle.

Multimodal Support

With WatsonX we support Image as input.

Installation

uv pip install -U ibm-watsonx-ai agno

Authentication

Set your IBM_WATSONX_API_KEY and IBM_WATSONX_PROJECT_ID environment variables. Get your credentials from IBM Cloud. You can also set the IBM_WATSONX_URL environment variable to the URL of the WatsonX API you want to use. It defaults to https://eu-de.ml.cloud.ibm.com.

export IBM_WATSONX_API_KEY="your_value_here"
export IBM_WATSONX_PROJECT_ID="your_value_here"

Example

Use WatsonX with your Agent:

from agno.agent import Agent
from agno.models.ibm import WatsonX

agent = Agent(
    model=WatsonX(id="meta-llama/llama-3-3-70b-instruct"),
    markdown=True
)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story.")
View more examples here.

Params

ParameterTypeDefaultDescription
idstr"ibm/granite-20b-code-instruct"The id of the IBM watsonx model to use
namestr"WatsonX"The name of the model
providerstr"IBM"The provider of the model
frequency_penaltyOptional[float]NonePenalizes new tokens based on their frequency in the text so far
presence_penaltyOptional[float]NonePenalizes new tokens based on whether they appear in the text so far
max_tokensOptional[int]NoneMaximum number of tokens to generate
temperatureOptional[float]NoneControls randomness in the model's output
top_pOptional[float]NoneControls diversity via nucleus sampling
logprobsOptional[int]NoneReturn log probabilities of the output tokens
top_logprobsOptional[int]NoneNumber of most likely tokens to return log probabilities for
request_paramsOptional[Dict[str, Any]]NoneAdditional parameters to include in the request
api_keyOptional[str]NoneThe API key for IBM watsonx (defaults to IBM_WATSONX_API_KEY env var)
project_idOptional[str]NoneThe project ID for IBM watsonx (defaults to IBM_WATSONX_PROJECT_ID env var)
urlOptional[str]"https://eu-de.ml.cloud.ibm.com"The watsonx endpoint URL (IBM_WATSONX_URL env var takes precedence)
verifyboolTrueVerify TLS certificates when connecting
client_paramsOptional[Dict[str, Any]]NoneAccepted but unused by this adapter; supply a preconfigured model_client for custom SDK configuration

WatsonX is a subclass of the Model class and has access to the same params.