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

See all the IBM WatsonX supported models here.

  • We recommend using meta-llama/llama-3-3-70b-instruct for general use
  • We recommend ibm/granite-20b-code-instruct for code-related tasks
  • We recommend using meta-llama/llama-3-2-11b-vision-instruct for image understanding

Multimodal Support

With WatsonX we support Image as input

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=***
export IBM_WATSONX_PROJECT_ID=***

Example

Use WatsonX with your Agent:

from agno.agent import Agent, RunResponse
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

Parameters

ParameterTypeDefaultDescription
idstr"ibm/granite-20b-code-instruct"The model ID to use
frequency_penaltyfloatNonePenalty for using frequent tokens. Higher values discourage repetition
presence_penaltyfloatNonePenalty for using tokens already present in the text. Higher values encourage new topics
max_tokensintNoneMaximum number of tokens to generate in the response
temperaturefloatNoneControls randomness in responses. Higher values make output more random
top_pfloatNoneControls diversity of responses via nucleus sampling
logprobsintNoneNumber of log probabilities to return
top_logprobsintNoneNumber of most likely tokens to return log probabilities for
response_formatAnyNoneFormat specification for the response
api_keystrNoneIBM WatsonX API key
project_idstrNoneIBM WatsonX project ID
urlstr"https://eu-de.ml.cloud.ibm.com"IBM WatsonX API endpoint URL
verifyboolTrueWhether to verify SSL certificates
client_paramsDict[str, Any]NoneAdditional parameters to pass to the client

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