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 agnoAuthentication
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.")
Params
| Parameter | Type | Default | Description |
|---|---|---|---|
id | str | "ibm/granite-20b-code-instruct" | The id of the IBM watsonx model to use |
name | str | "WatsonX" | The name of the model |
provider | str | "IBM" | The provider of the model |
frequency_penalty | Optional[float] | None | Penalizes new tokens based on their frequency in the text so far |
presence_penalty | Optional[float] | None | Penalizes new tokens based on whether they appear in the text so far |
max_tokens | Optional[int] | None | Maximum number of tokens to generate |
temperature | Optional[float] | None | Controls randomness in the model's output |
top_p | Optional[float] | None | Controls diversity via nucleus sampling |
logprobs | Optional[int] | None | Return log probabilities of the output tokens |
top_logprobs | Optional[int] | None | Number of most likely tokens to return log probabilities for |
request_params | Optional[Dict[str, Any]] | None | Additional parameters to include in the request |
api_key | Optional[str] | None | The API key for IBM watsonx (defaults to IBM_WATSONX_API_KEY env var) |
project_id | Optional[str] | None | The project ID for IBM watsonx (defaults to IBM_WATSONX_PROJECT_ID env var) |
url | Optional[str] | "https://eu-de.ml.cloud.ibm.com" | The watsonx endpoint URL (IBM_WATSONX_URL env var takes precedence) |
verify | bool | True | Verify TLS certificates when connecting |
client_params | Optional[Dict[str, Any]] | None | Accepted 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.