ibm-watsonx-ai-cli


Nameibm-watsonx-ai-cli JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryCLI for deploying AI services with Agents to watsonx.ai.
upload_time2025-07-22 09:53:23
maintainerNone
docs_urlNone
authorIBM
requires_python<3.14,>=3.10
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ibm-watsonx-ai-cli

CLI tool that enables developers to deploy AI services to watsonx.ai directly from their local environment.

# IBM watsonx.ai CLI for Agents

Repository containing source code for `ibm-watsonx-ai-cli` package.

## Contact info

### Maintainers

- **Łukasz Ćmielowski** - [lukasz.cmielowski@pl.ibm.com](mailto:lukasz.cmielowski@pl.ibm.com)
- **Daniel Ryszka** – [daniel.ryszka@pl.ibm.com](mailto:daniel.ryszka@pl.ibm.com)
- **Mateusz Szewczyk** – [mateusz.szewczyk@ibm.com](mailto:mateusz.szewczyk@ibm.com)
- **Mateusz Świtała** – [mateusz.switala@ibm.com](mailto:mateusz.switala@ibm.com)

## Installation

```commandline
pip install -U ibm-watsonx-ai-cli
```

> [!WARNING]
> The `ibm_watsonx_ai_cli` package requires `poetry` to be installed.
> To install Poetry, follow the instructions on the [Poetry installation page](https://python-poetry.org/docs/#installation).

## Usage

### Run CLI

```console
$ watsonx-ai [OPTIONS] COMMAND [ARGS]...
```

[OPTIONS]
```console
--version  -v           Print the current CLI version.
--help                  Show this message and exit.
```

COMMAND
```console
- template              Explore, download and try-out the template.
- service               Work with deployed templates.
- app                   Build & run an UI playground.
```

`TEMPLATE`
```console
- list                  List all available templates.
- new                   Creates a selected template in a local env.  [ARGS: name, target]
- invoke                Executes the template code locally with demo data.  [OPTIONAL ARGS: query]
- eval                  Evaluates the agent locally using the provided metrics and input data. [REQUIRED ARGS: --tests, --metrics, OPTIONAL ARG: --evaluator]
```

`SERVICE`
```console
- list                   List all deployed AI services.
- new                    Create & deploy a new ai service from a root template directory. [OPTIONAL ARGS: name]
- get                    Get service details. [OPTIONAL ARGS: deployment_id (deployment_id)]
- delete                 Deletes ai service. [ARGS: deployment_id]
- invoke                 Calls the service by providing the test record. [OPTIONAL ARGS: deployment_id, query]
```

`APP`
```console
- list                  List playground app samples.
- new                   Creates a demo playground app for the service.  [OPTIONAL ARGS: name, target_dir]
- run                   Start the playground app.  [OPTIONAL ARGS: target_dir]
```


---

### Template

#### `watsonx-ai template list`

List all available templates.

__Usage:__

```console
$ watsonx-ai template list [OPTIONS]
```

__Options:__
 - `--help`: Show this message and exit.

#### `watsonx-ai template new`

Creates a selected template in a local env.

__Usage:__

```console
$ watsonx-ai template new [OPTIONS] name target
```

__Arguments:__

 - `name`: Name of the template to download or its index in the list of available templates.
 - `target`: Target directory where template will be saved.

__Options:__
 - `--help`: Show this message and exit.

#### `watsonx-ai template invoke`

Executes the template code locally with demo data.

__Usage:__

```console
$ watsonx-ai template invoke [OPTIONS] query
```

__Arguments:__

 - `query`:[Optional] Input query for template code. If not specified, searches for the `cli.options.payload_path` file to be specified in config.toml. Content of `cli.options.payload_path` will be directly send to the AI service and should agree with AI service request schema.

__Options:__
 - `--help`: Show this message and exit.

#### `watsonx-ai template eval`

Evaluates the agent locally using the provided metrics and input data.

__Usage:__

```console
$ watsonx-ai template eval --tests test.jsonl --metrics answer_similarity,answer_relevance --evaluator llm_as_judge
```

__Options:__
 - `--help`: Show this message and exit.
 - `--tests`: [Required] one or more input data files (in jsonl format) for evaluation
 - `--metrics`: [Required] one or more evaluation metric
 - `--evaluator`: [Optional]  Only `llm_as_judge` is allowed. If not provided, metrics are computed using the method 'token_recall'.

__Types of metrics:__
- `answer_similarity`: Measures the similarity between the generated text and the ground truth. By default, it uses token_recall. If the `--evaluator llm_as_judge` flag is set, is uses llm_as_judge
- `answer_relevance`: Measures the relevance of the generated text to the given input query. By default, it uses token_recall. If the `--evaluator llm_as_judge` flag is set, is uses llm_as_judge
- `text_reading_ease`: Measures how readable the text is. Although the `--evaluator llm_as_judge` flag can be passed, this metric always uses a rule-based method and ignores the evaluator setting.
- `unsuccessful_request_metric`: Measures whether the agent answered the request successfully or not by comparing the generated text against the list of unsuccessful phrases. Although the `--evaluator llm_as_judge` flag can be passed, this metric always uses a rule-based method and ignores the evaluator setting.
- `text_grade_level`: The Text Grade Level metric measures the approximate reading US grade level of a text. Although the `--evaluator llm_as_judge` flag can be passed, this metric always uses a rule-based method and ignores the evaluator setting.


### Service

#### `watsonx-ai service list`

List all deployed AI services.

__Usage:__

```console
$ watsonx-ai service list [OPTIONS]
```

__Options:__
 - `--help`: Show this message and exit.

#### `watsonx-ai service new`

Create & deploy a new AI service from a root template directory. After successful deployment creation the `deployment_id` will be saved automatically in section `[deployment]` in  `config.toml`.

When running this command a package distribution with implemented agent will be created in folder `dist`. Warning! If `dist` already exists, distribution creation is skipped.

__Usage:__

```console
$ watsonx-ai service new [OPTIONS] name
```
__Arguments:__

 - `name`:[Optional] Name for the deployed AI service. If not provided, name for the deployment will be the same as name of current directory.

__Options:__
 - `--help`: Show this message and exit.


#### `watsonx-ai service get`

Get deployed service details.

__Usage:__

```console
$ watsonx-ai service get [OPTIONS] deployment_id
```
__Arguments:__

 - `deployment_id`: Id of the deployed AI service.

__Options:__
 - `--help`: Show this message and exit.


#### `watsonx-ai service delete`

Deletes ai service.

__Usage:__

```console
$ watsonx-ai service delete [OPTIONS] deployment_id
```
__Arguments:__

 - `deployment_id`: Id of the deployed AI service.

__Options:__
 - `--help`: Show this message and exit.


#### `watsonx-ai service invoke`

Calls the service by providing the test record.

__Usage:__

```console
$ watsonx-ai service invoke [OPTIONS] query
```
__Arguments:__

 - `query`:[Optional] Test data to send to deployed AI service. If not specified, searches for the `cli.options.payload_path` file to be specified in config.toml. Content of `cli.options.payload_path` will be directly send to the deployed AI service and should agree with AI service request schema.

__Options:__

 - `--deployment_id`:[Optional] Id of a deployed AI service. If not provided, taken from `deployment.deployment_id` field from `config.toml`.
 - `--help`: Show this message and exit.

### App

#### `watsonx-ai app list`

List playground app samples.

__Usage:__

```console
$ watsonx-ai app list [OPTIONS]
```

__Options:__
 - `--help`: Show this message and exit.

#### `watsonx-ai app new`

Creates a demo playground app for the service.

__Usage:__

```console
$ watsonx-ai app new [OPTIONS] name target_dir
```
__Arguments:__

 - `name`:[Optional] The name of the app to use. If not provided, the user will be prompted to choose one.
 - `target_dir`:[Optional] The target folder where the app will be downloaded. If not provided, the user will be prompted to enter one.

__Options:__
 - `--help`: Show this message and exit.

#### `watsonx-ai app run`

Start the playground app.

__Usage:__

```console
$ watsonx-ai app run [OPTIONS] target_dir
```
__Arguments:__

 - `target_dir`:[Optional] The directory to the app.

__Options:__
 - `--help`: Show this message and exit.
 - `--dev | -d`:[Optional] A flag indicating either app should be deployed in developer mode.


## Secrets

### Environment Variables for IBM watsonx.ai for IBM Cloud
For security reasons, it's recommended to not hard-code your API key or other secrets directly in your scripts or `config.toml`. Instead, set it up as an environment variable. Below variables will be used to authenticate to watsonx.ai APIs if analogous ones not provided in configuration file.

```python
import os

WATSONX_URL = os.environ.get("WATSONX_URL", "")
WATSONX_APIKEY = os.environ.get("WATSONX_APIKEY", "")
WATSONX_TOKEN = os.environ.get("WATSONX_TOKEN", "")
WATSONX_SPACE_ID = os.environ.get("WATSONX_SPACE_ID", "")
WATSONX_PROJECT_ID = os.environ.get("WATSONX_PROJECT_ID", "")
```

### Config file (`config.toml`)
`config.toml` is an optional file that can be defined in template's directory. Please note, that some templates will require a correctly prepared `config.toml` since template's content may depends on some of the available configuration options. If a downloaded template has `config.toml` with placeholders, please read its description carefully and fill in required fields.

#### Available configuration options

Below are all the sections and options you can have in your `config.toml`

[cli.options]
```yaml
[cli.options]
  # If true, cli `invoke` command is trying to use `ai_service.generate_stream` function for local tests, and `ai_service.generate` otherwise.
  # Default: true
  stream = true

  # Path to json file with a complete payload that will be send to proper AI service generate function.
  # Note that, the payload file will be only used when no `query` is provided when running `invoke ` command
  # Default: None
  payload_path = ""

```


[deployment]

If present, its fields will be used for authentication to watsonx.ai APIs.
```yaml
[deployment]
  # One of the below is required.
  # To determine your `api_key`, refer to `IBM Cloud console API keys <https://cloud.ibm.com/iam/apikeys>`_.
  watsonx_apikey = "PLACEHOLDER FOR YOUR APIKEY"
  watsonx_token = "PLACEHOLDER FOR YOUR TOKEN"

  # should follow the format: `https://{REGION}.ml.cloud.ibm.com`
  watsonx_url = ""

  # Deployment space id is required to create deployment with AI service content.
  space_id = "PLACEHOLDER FOR YOUR SPACE ID"

  # variable, that is populated with last created deployment_id every time when command `watsonx-ai service new` finish successfully
  deployment_id = ""

```

[deployment.online.parameters]

This section is recommended for users of IBM watsonx.ai for IBM Cloud and when some additional parameters need to be passed to the AI service function during deployment creation. When creating a deployment, additional parameters can be passed inside the `ONLINE.PARAMETERS` object to further reference in the content of the AI service function. The exact set of parameters may depend on the template used.
```yaml
[deployment.online.parameters]

# Example set of parameters that must be passed during deployment creation of particular template to guarantee its correct functioning
  url = ""  # should follow the format: `https://{REGION}.ml.cloud.ibm.com`
  space_id = "PLACEHOLDER FOR YOUR SPACE ID"
  model_id = "mistralai/mistral-large"  # underlying model for inference
```

[deployment.software_specification]

During deployment creation, the custom software specification with template package distribution is stored for use when running AI service inference. For more details about software specifications you can find in _IBM watsonx.ai Runtime Supported frameworks and software specifications_ [documentation](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/pm_service_supported_frameworks.html?context=wx&audience=wdp) and _Customizing deployment runtimes_ [documentation](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-customize.html?context=wx&audience=wdp).
```yaml
[deployment.software_specification]
  # Name for derived software specification. If not provided, default one is used that will be build based on the package name: "{pkg_name}-sw-spec"
  name = ""

  # Whether to overwrite (delete existing and create new with the same name) watsonx derived software specification
  # Default: false
  overwrite = false

  # The base software specification used to deploy the AI service. The template dependencies will be installed based on the packages included in the selected base software specification
  # Default: "runtime-24.1-py3.11"
  base_sw_spec = "runtime-24.1-py3.11"
```

## Sample flow
1. List available templates
   ```console
   watsonx-ai template list
   ```
2. Create the template in my IDE
   ```console
   watsonx-ai template new "base/langgraph-react-agent" "langgraph-react-agent"
   ```
3. Go into template directory
   ```console
   cd langgraph-react-agent
   cp config.toml.example config.toml
   ```
4. Customize the template code and `config.toml` to my needs
5. Test the template code by calling invoke:
   ```console
   watsonx-ai template invoke "question"
   ```
6. Create a service
   ```console
   watsonx-ai service new
   ```
7. Test the service
   ```console
   watsonx-ai service invoke "question"
   ```
8. List available apps
   ```console
   watsonx-ai app list
   ```
9. Create an app in my IDE
   ```console
   watsonx-ai app new "base/nextjs-chat-with-ai-service" "chat-with-ai-service_app"
   ```
10. Go into app directory and copy your environment variable file.
   ```console
   cd chat-with-ai-service_app
   cp template.env .env
   ```
11. Update `.env` file with your credentials
12. Start the playground app.
   ```console
   watsonx-ai app run
   ```

## Support for Forks or Copies of `watsonx-developer-hub`

You can now configure the CLI to retrieve agent templates from a forked or mirrored version of the official `watsonx-developer-hub` repository.
To do this, set the following environment variables before invoking any commands:

### `TEMPLATE_REPO_URL`
- **Description**: URL of the Git repository containing your customized agent templates.
- **Default**: https://github.com/IBM/watsonx-developer-hub
- **Example**:
  ```console
  export TEMPLATE_REPO_URL="https://github.com/your-org/your-forked-repo"
  ```

### `TEMPLATE_REPO_BRANCH`
- **Description**: Branch name within the repository where the agent templates reside.
- **Default**: main
- **Example**:
  ```console
  export TEMPLATE_REPO_BRANCH="development"
  ```

### `TEMPLATE_REPO_TOKEN`
- **Description**: Personal access token (PAT) or other valid credential used to authenticate against a private repository.
- **None**: If the target repository is public, this variable is optional.
- **Example**:
  ```console
  export TEMPLATE_REPO_TOKEN="<YOUR_TOKEN>"
  ```

### Supported Git Providers

- **GitHub**
- **GitLab**

If you configure TEMPLATE_REPO_URL to point to a host other than GitHub or GitLab, the CLI will return an error indicating that the provider is unsupported.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ibm-watsonx-ai-cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.10",
    "maintainer_email": "\u0141ukasz \u0106mielowski <lukasz.cmielowski@pl.ibm.com>, Daniel Ryszka <daniel.ryszka@pl.ibm.com>, Mateusz Szewczyk <mateusz.szewczyk@ibm.com>, Mateusz \u015awitala <mateusz.switala@ibm.com>",
    "keywords": null,
    "author": "IBM",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/a6/79/75f2c988313f7ce9f284ff361e38479c4e56b49f4f824691974b325c89b9/ibm_watsonx_ai_cli-0.2.0.tar.gz",
    "platform": null,
    "description": "# ibm-watsonx-ai-cli\n\nCLI tool that enables developers to deploy AI services to watsonx.ai directly from their local environment.\n\n# IBM watsonx.ai CLI for Agents\n\nRepository containing source code for `ibm-watsonx-ai-cli` package.\n\n## Contact info\n\n### Maintainers\n\n- **\u0141ukasz \u0106mielowski** - [lukasz.cmielowski@pl.ibm.com](mailto:lukasz.cmielowski@pl.ibm.com)\n- **Daniel Ryszka** \u2013 [daniel.ryszka@pl.ibm.com](mailto:daniel.ryszka@pl.ibm.com)\n- **Mateusz Szewczyk** \u2013 [mateusz.szewczyk@ibm.com](mailto:mateusz.szewczyk@ibm.com)\n- **Mateusz \u015awita\u0142a** \u2013 [mateusz.switala@ibm.com](mailto:mateusz.switala@ibm.com)\n\n## Installation\n\n```commandline\npip install -U ibm-watsonx-ai-cli\n```\n\n> [!WARNING]\n> The `ibm_watsonx_ai_cli` package requires `poetry` to be installed.\n> To install Poetry, follow the instructions on the [Poetry installation page](https://python-poetry.org/docs/#installation).\n\n## Usage\n\n### Run CLI\n\n```console\n$ watsonx-ai [OPTIONS] COMMAND [ARGS]...\n```\n\n[OPTIONS]\n```console\n--version  -v           Print the current CLI version.\n--help                  Show this message and exit.\n```\n\nCOMMAND\n```console\n- template              Explore, download and try-out the template.\n- service               Work with deployed templates.\n- app                   Build & run an UI playground.\n```\n\n`TEMPLATE`\n```console\n- list                  List all available templates.\n- new                   Creates a selected template in a local env.  [ARGS: name, target]\n- invoke                Executes the template code locally with demo data.  [OPTIONAL ARGS: query]\n- eval                  Evaluates the agent locally using the provided metrics and input data. [REQUIRED ARGS: --tests, --metrics, OPTIONAL ARG: --evaluator]\n```\n\n`SERVICE`\n```console\n- list                   List all deployed AI services.\n- new                    Create & deploy a new ai service from a root template directory. [OPTIONAL ARGS: name]\n- get                    Get service details. [OPTIONAL ARGS: deployment_id (deployment_id)]\n- delete                 Deletes ai service. [ARGS: deployment_id]\n- invoke                 Calls the service by providing the test record. [OPTIONAL ARGS: deployment_id, query]\n```\n\n`APP`\n```console\n- list                  List playground app samples.\n- new                   Creates a demo playground app for the service.  [OPTIONAL ARGS: name, target_dir]\n- run                   Start the playground app.  [OPTIONAL ARGS: target_dir]\n```\n\n\n---\n\n### Template\n\n#### `watsonx-ai template list`\n\nList all available templates.\n\n__Usage:__\n\n```console\n$ watsonx-ai template list [OPTIONS]\n```\n\n__Options:__\n - `--help`: Show this message and exit.\n\n#### `watsonx-ai template new`\n\nCreates a selected template in a local env.\n\n__Usage:__\n\n```console\n$ watsonx-ai template new [OPTIONS] name target\n```\n\n__Arguments:__\n\n - `name`: Name of the template to download or its index in the list of available templates.\n - `target`: Target directory where template will be saved.\n\n__Options:__\n - `--help`: Show this message and exit.\n\n#### `watsonx-ai template invoke`\n\nExecutes the template code locally with demo data.\n\n__Usage:__\n\n```console\n$ watsonx-ai template invoke [OPTIONS] query\n```\n\n__Arguments:__\n\n - `query`:[Optional] Input query for template code. If not specified, searches for the `cli.options.payload_path` file to be specified in config.toml. Content of `cli.options.payload_path` will be directly send to the AI service and should agree with AI service request schema.\n\n__Options:__\n - `--help`: Show this message and exit.\n\n#### `watsonx-ai template eval`\n\nEvaluates the agent locally using the provided metrics and input data.\n\n__Usage:__\n\n```console\n$ watsonx-ai template eval --tests test.jsonl --metrics answer_similarity,answer_relevance --evaluator llm_as_judge\n```\n\n__Options:__\n - `--help`: Show this message and exit.\n - `--tests`: [Required] one or more input data files (in jsonl format) for evaluation\n - `--metrics`: [Required] one or more evaluation metric\n - `--evaluator`: [Optional]  Only `llm_as_judge` is allowed. If not provided, metrics are computed using the method 'token_recall'.\n\n__Types of metrics:__\n- `answer_similarity`: Measures the similarity between the generated text and the ground truth. By default, it uses token_recall. If the `--evaluator llm_as_judge` flag is set, is uses llm_as_judge\n- `answer_relevance`: Measures the relevance of the generated text to the given input query. By default, it uses token_recall. If the `--evaluator llm_as_judge` flag is set, is uses llm_as_judge\n- `text_reading_ease`: Measures how readable the text is. Although the `--evaluator llm_as_judge` flag can be passed, this metric always uses a rule-based method and ignores the evaluator setting.\n- `unsuccessful_request_metric`: Measures whether the agent answered the request successfully or not by comparing the generated text against the list of unsuccessful phrases. Although the `--evaluator llm_as_judge` flag can be passed, this metric always uses a rule-based method and ignores the evaluator setting.\n- `text_grade_level`: The Text Grade Level metric measures the approximate reading US grade level of a text. Although the `--evaluator llm_as_judge` flag can be passed, this metric always uses a rule-based method and ignores the evaluator setting.\n\n\n### Service\n\n#### `watsonx-ai service list`\n\nList all deployed AI services.\n\n__Usage:__\n\n```console\n$ watsonx-ai service list [OPTIONS]\n```\n\n__Options:__\n - `--help`: Show this message and exit.\n\n#### `watsonx-ai service new`\n\nCreate & deploy a new AI service from a root template directory. After successful deployment creation the `deployment_id` will be saved automatically in section `[deployment]` in  `config.toml`.\n\nWhen running this command a package distribution with implemented agent will be created in folder `dist`. Warning! If `dist` already exists, distribution creation is skipped.\n\n__Usage:__\n\n```console\n$ watsonx-ai service new [OPTIONS] name\n```\n__Arguments:__\n\n - `name`:[Optional] Name for the deployed AI service. If not provided, name for the deployment will be the same as name of current directory.\n\n__Options:__\n - `--help`: Show this message and exit.\n\n\n#### `watsonx-ai service get`\n\nGet deployed service details.\n\n__Usage:__\n\n```console\n$ watsonx-ai service get [OPTIONS] deployment_id\n```\n__Arguments:__\n\n - `deployment_id`: Id of the deployed AI service.\n\n__Options:__\n - `--help`: Show this message and exit.\n\n\n#### `watsonx-ai service delete`\n\nDeletes ai service.\n\n__Usage:__\n\n```console\n$ watsonx-ai service delete [OPTIONS] deployment_id\n```\n__Arguments:__\n\n - `deployment_id`: Id of the deployed AI service.\n\n__Options:__\n - `--help`: Show this message and exit.\n\n\n#### `watsonx-ai service invoke`\n\nCalls the service by providing the test record.\n\n__Usage:__\n\n```console\n$ watsonx-ai service invoke [OPTIONS] query\n```\n__Arguments:__\n\n - `query`:[Optional] Test data to send to deployed AI service. If not specified, searches for the `cli.options.payload_path` file to be specified in config.toml. Content of `cli.options.payload_path` will be directly send to the deployed AI service and should agree with AI service request schema.\n\n__Options:__\n\n - `--deployment_id`:[Optional] Id of a deployed AI service. If not provided, taken from `deployment.deployment_id` field from `config.toml`.\n - `--help`: Show this message and exit.\n\n### App\n\n#### `watsonx-ai app list`\n\nList playground app samples.\n\n__Usage:__\n\n```console\n$ watsonx-ai app list [OPTIONS]\n```\n\n__Options:__\n - `--help`: Show this message and exit.\n\n#### `watsonx-ai app new`\n\nCreates a demo playground app for the service.\n\n__Usage:__\n\n```console\n$ watsonx-ai app new [OPTIONS] name target_dir\n```\n__Arguments:__\n\n - `name`:[Optional] The name of the app to use. If not provided, the user will be prompted to choose one.\n - `target_dir`:[Optional] The target folder where the app will be downloaded. If not provided, the user will be prompted to enter one.\n\n__Options:__\n - `--help`: Show this message and exit.\n\n#### `watsonx-ai app run`\n\nStart the playground app.\n\n__Usage:__\n\n```console\n$ watsonx-ai app run [OPTIONS] target_dir\n```\n__Arguments:__\n\n - `target_dir`:[Optional] The directory to the app.\n\n__Options:__\n - `--help`: Show this message and exit.\n - `--dev | -d`:[Optional] A flag indicating either app should be deployed in developer mode.\n\n\n## Secrets\n\n### Environment Variables for IBM watsonx.ai for IBM Cloud\nFor security reasons, it's recommended to not hard-code your API key or other secrets directly in your scripts or `config.toml`. Instead, set it up as an environment variable. Below variables will be used to authenticate to watsonx.ai APIs if analogous ones not provided in configuration file.\n\n```python\nimport os\n\nWATSONX_URL = os.environ.get(\"WATSONX_URL\", \"\")\nWATSONX_APIKEY = os.environ.get(\"WATSONX_APIKEY\", \"\")\nWATSONX_TOKEN = os.environ.get(\"WATSONX_TOKEN\", \"\")\nWATSONX_SPACE_ID = os.environ.get(\"WATSONX_SPACE_ID\", \"\")\nWATSONX_PROJECT_ID = os.environ.get(\"WATSONX_PROJECT_ID\", \"\")\n```\n\n### Config file (`config.toml`)\n`config.toml` is an optional file that can be defined in template's directory. Please note, that some templates will require a correctly prepared `config.toml` since template's content may depends on some of the available configuration options. If a downloaded template has `config.toml` with placeholders, please read its description carefully and fill in required fields.\n\n#### Available configuration options\n\nBelow are all the sections and options you can have in your `config.toml`\n\n[cli.options]\n```yaml\n[cli.options]\n  # If true, cli `invoke` command is trying to use `ai_service.generate_stream` function for local tests, and `ai_service.generate` otherwise.\n  # Default: true\n  stream = true\n\n  # Path to json file with a complete payload that will be send to proper AI service generate function.\n  # Note that, the payload file will be only used when no `query` is provided when running `invoke ` command\n  # Default: None\n  payload_path = \"\"\n\n```\n\n\n[deployment]\n\nIf present, its fields will be used for authentication to watsonx.ai APIs.\n```yaml\n[deployment]\n  # One of the below is required.\n  # To determine your `api_key`, refer to `IBM Cloud console API keys <https://cloud.ibm.com/iam/apikeys>`_.\n  watsonx_apikey = \"PLACEHOLDER FOR YOUR APIKEY\"\n  watsonx_token = \"PLACEHOLDER FOR YOUR TOKEN\"\n\n  # should follow the format: `https://{REGION}.ml.cloud.ibm.com`\n  watsonx_url = \"\"\n\n  # Deployment space id is required to create deployment with AI service content.\n  space_id = \"PLACEHOLDER FOR YOUR SPACE ID\"\n\n  # variable, that is populated with last created deployment_id every time when command `watsonx-ai service new` finish successfully\n  deployment_id = \"\"\n\n```\n\n[deployment.online.parameters]\n\nThis section is recommended for users of IBM watsonx.ai for IBM Cloud and when some additional parameters need to be passed to the AI service function during deployment creation. When creating a deployment, additional parameters can be passed inside the `ONLINE.PARAMETERS` object to further reference in the content of the AI service function. The exact set of parameters may depend on the template used.\n```yaml\n[deployment.online.parameters]\n\n# Example set of parameters that must be passed during deployment creation of particular template to guarantee its correct functioning\n  url = \"\"  # should follow the format: `https://{REGION}.ml.cloud.ibm.com`\n  space_id = \"PLACEHOLDER FOR YOUR SPACE ID\"\n  model_id = \"mistralai/mistral-large\"  # underlying model for inference\n```\n\n[deployment.software_specification]\n\nDuring deployment creation, the custom software specification with template package distribution is stored for use when running AI service inference. For more details about software specifications you can find in _IBM watsonx.ai Runtime Supported frameworks and software specifications_ [documentation](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/pm_service_supported_frameworks.html?context=wx&audience=wdp) and _Customizing deployment runtimes_ [documentation](https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/ml-customize.html?context=wx&audience=wdp).\n```yaml\n[deployment.software_specification]\n  # Name for derived software specification. If not provided, default one is used that will be build based on the package name: \"{pkg_name}-sw-spec\"\n  name = \"\"\n\n  # Whether to overwrite (delete existing and create new with the same name) watsonx derived software specification\n  # Default: false\n  overwrite = false\n\n  # The base software specification used to deploy the AI service. The template dependencies will be installed based on the packages included in the selected base software specification\n  # Default: \"runtime-24.1-py3.11\"\n  base_sw_spec = \"runtime-24.1-py3.11\"\n```\n\n## Sample flow\n1. List available templates\n   ```console\n   watsonx-ai template list\n   ```\n2. Create the template in my IDE\n   ```console\n   watsonx-ai template new \"base/langgraph-react-agent\" \"langgraph-react-agent\"\n   ```\n3. Go into template directory\n   ```console\n   cd langgraph-react-agent\n   cp config.toml.example config.toml\n   ```\n4. Customize the template code and `config.toml` to my needs\n5. Test the template code by calling invoke:\n   ```console\n   watsonx-ai template invoke \"question\"\n   ```\n6. Create a service\n   ```console\n   watsonx-ai service new\n   ```\n7. Test the service\n   ```console\n   watsonx-ai service invoke \"question\"\n   ```\n8. List available apps\n   ```console\n   watsonx-ai app list\n   ```\n9. Create an app in my IDE\n   ```console\n   watsonx-ai app new \"base/nextjs-chat-with-ai-service\" \"chat-with-ai-service_app\"\n   ```\n10. Go into app directory and copy your environment variable file.\n   ```console\n   cd chat-with-ai-service_app\n   cp template.env .env\n   ```\n11. Update `.env` file with your credentials\n12. Start the playground app.\n   ```console\n   watsonx-ai app run\n   ```\n\n## Support for Forks or Copies of `watsonx-developer-hub`\n\nYou can now configure the CLI to retrieve agent templates from a forked or mirrored version of the official `watsonx-developer-hub` repository.\nTo do this, set the following environment variables before invoking any commands:\n\n### `TEMPLATE_REPO_URL`\n- **Description**: URL of the Git repository containing your customized agent templates.\n- **Default**: https://github.com/IBM/watsonx-developer-hub\n- **Example**:\n  ```console\n  export TEMPLATE_REPO_URL=\"https://github.com/your-org/your-forked-repo\"\n  ```\n\n### `TEMPLATE_REPO_BRANCH`\n- **Description**: Branch name within the repository where the agent templates reside.\n- **Default**: main\n- **Example**:\n  ```console\n  export TEMPLATE_REPO_BRANCH=\"development\"\n  ```\n\n### `TEMPLATE_REPO_TOKEN`\n- **Description**: Personal access token (PAT) or other valid credential used to authenticate against a private repository.\n- **None**: If the target repository is public, this variable is optional.\n- **Example**:\n  ```console\n  export TEMPLATE_REPO_TOKEN=\"<YOUR_TOKEN>\"\n  ```\n\n### Supported Git Providers\n\n- **GitHub**\n- **GitLab**\n\nIf you configure TEMPLATE_REPO_URL to point to a host other than GitHub or GitLab, the CLI will return an error indicating that the provider is unsupported.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "CLI for deploying AI services with Agents to watsonx.ai.",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "45997706c29c68bc7eb25fd84abf1d6729ce2102eef3e35a479f7c7c8ce2de35",
                "md5": "20a6e4fb9d5d31cfdaed42f1534eab68",
                "sha256": "ac1ea0ed39bdb2474cac1c31eb0f769bf027bd2650fb2e3dc416ba55f9172d72"
            },
            "downloads": -1,
            "filename": "ibm_watsonx_ai_cli-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20a6e4fb9d5d31cfdaed42f1534eab68",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.10",
            "size": 39794,
            "upload_time": "2025-07-22T09:53:23",
            "upload_time_iso_8601": "2025-07-22T09:53:23.007075Z",
            "url": "https://files.pythonhosted.org/packages/45/99/7706c29c68bc7eb25fd84abf1d6729ce2102eef3e35a479f7c7c8ce2de35/ibm_watsonx_ai_cli-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a67975f2c988313f7ce9f284ff361e38479c4e56b49f4f824691974b325c89b9",
                "md5": "375ae3a15a10d6f521106eadc80890f9",
                "sha256": "d391ba023cffc32f8fc0a5564160429ad3443f64274fdf482582c9c42b4e304b"
            },
            "downloads": -1,
            "filename": "ibm_watsonx_ai_cli-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "375ae3a15a10d6f521106eadc80890f9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.10",
            "size": 36588,
            "upload_time": "2025-07-22T09:53:23",
            "upload_time_iso_8601": "2025-07-22T09:53:23.995032Z",
            "url": "https://files.pythonhosted.org/packages/a6/79/75f2c988313f7ce9f284ff361e38479c4e56b49f4f824691974b325c89b9/ibm_watsonx_ai_cli-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-22 09:53:23",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ibm-watsonx-ai-cli"
}
        
IBM
Elapsed time: 1.65669s