Agent Build智能体搭建 Tutor教程
Platforms各平台 / Managed agent platform托管的智能体平台

IBM watsonx Orchestrate

Orchestrate is the harness. You declare agents in YAML, write tools in Python, and import both with a command-line tool. The platform runs the loop.Orchestrate 本身就是 Harness。你用 YAML 声明智能体,用 Python 编写工具,再用命令行工具把两者导入。循环由平台运行。

These guides were written from vendor documentation read in October 2026. None was executed: there was no account on these platforms. Product names change often. Confirm each command against the linked source before you rely on it.这些指南依据 2026 年 10 月查阅的厂商文档编写。全部未经实际执行:编写时没有这些平台的账号。产品名称经常变化。使用前请对照链接的来源逐条核实命令。

What you own归你负责的

Tool code, agent YAML and instructions, knowledge sources, test cases.工具代码、智能体 YAML 和指令、知识来源、测试用例。

What the platform runs由平台运行的

The agent loop, model access, thread state, the chat UI, deployment across environments.智能体循环、模型访问、会话状态、聊天界面、跨环境部署。

Build steps搭建步骤

01Install the kit and connect an environment安装开发套件并连接环境

Do this操作

  1. Install the Agent Development Kit.安装 Agent Development Kit。
  2. Add your service instance as an environment and activate it.把你的服务实例添加为一个环境并激活。
bash
pip install --upgrade ibm-watsonx-orchestrate
orchestrate env add -n my-env -u <service-instance-url>
orchestrate env activate my-env
You are done when完成标志`orchestrate tools list` runs without an authentication error.`orchestrate tools list` 运行时没有认证错误。
02Write a Python tool and import it编写一个 Python 工具并导入

Do this操作

  1. Decorate a function with the kit's tool decorator. The docstring describes it to the model.用套件提供的 tool 装饰器装饰函数。docstring 向模型描述这个工具。
  2. Return a diagnostic when the result is empty, as in lab 6.结果为空时返回诊断信息,做法同 lab 6。
  3. Import the file with its requirements.连同依赖文件一起导入。
expenses_tool.py
from ibm_watsonx_orchestrate.agent_builder.tools import tool


@tool()
def query_expenses(category: str = "", city: str = "", month: str = "") -> dict:
    """Total and list expense records. Filters are optional: category, city, month (YYYY-MM)."""
    ...

# orchestrate tools import -k python -f expenses_tool.py -r requirements.txt
You are done when完成标志The tool appears in `orchestrate tools list`.该工具出现在 `orchestrate tools list` 的输出里。
03Or register the MCP server from lab 6 as a toolkit或者把 lab 6 的 MCP 服务注册为工具包

Do this操作

  1. Add a toolkit of kind mcp with the command that starts your server.添加一个 mcp 类型的工具包,并给出启动你的服务的命令。
  2. Expose all tools or name the ones to expose.暴露全部工具,或指定要暴露哪些。
bash
orchestrate toolkits add \
  --kind mcp \
  --name policy_desk \
  --description "Policy search and expense queries" \
  --package_root ./mcp_server \
  --command "python server.py" \
  --tools "*"
You are done when完成标志Both tools from the server are listed.该服务的两个工具都被列出。
04Create a knowledge base创建知识库

Do this操作

  1. A knowledge base takes uploaded files or a connected vector store such as Milvus, Elasticsearch, or AstraDB.知识库可以使用上传的文件,或接入 Milvus、Elasticsearch、AstraDB 这类向量库。
  2. Validate and curate documents first, with the intake from lab 3. The platform indexes what you give it.先用 lab 3 的入库流程校验和整理文档。你给什么,平台就索引什么。
  3. The import command was not on the pages read. Follow the knowledge base page under sources.所查阅的页面上没有给出导入命令。请按“来源”里的知识库页面操作。
You are done when完成标志A question whose answer is only in your documents is answered with a citation.一个答案只存在于你的文档中的问题,得到了带引用的回答。
05Declare the agent in YAML and import it用 YAML 声明智能体并导入

Do this操作

  1. Write name, model, description, and instructions. List tools, collaborators, and knowledge bases by name.写明名称、模型、描述和指令。按名称列出工具、协作者和知识库。
  2. Put the instructions from your base prompt and skills here.把基础提示词和技能里的指令写在这里。
  3. Import the file, then test in the Agent Builder chat.导入文件,然后在 Agent Builder 的聊天界面里测试。
  4. The field names were confirmed on the vendor page. The values shown for spec_version, kind, and style are from general knowledge. Confirm them there.字段名已在厂商页面上确认。示例中 spec_version、kind 和 style 的取值来自一般性了解,请到该页面核实。
policy-desk.yaml
spec_version: v1
kind: native
name: policy_desk
llm: <model id from your environment>
style: default
description: Answers travel policy and expense questions.
instructions: >
  Use a tool before stating any rule, limit or amount.
  Report only what a tool returned. If a tool returns nothing, say what you searched.
tools:
  - query_expenses
knowledge_base:
  - travel_policy
collaborators: []

# orchestrate agents import -f policy-desk.yaml
You are done when完成标志The agent answers the Boston lodging question from lab 7 with the figure from your tool.智能体用你的工具返回的数字回答了 lab 7 里关于波士顿住宿的问题。
06Split work with collaborators用协作者拆分工作

Do this操作

  1. Create one narrow agent per role, each with its own tools.为每个角色创建一个专职智能体,各自拥有自己的工具。
  2. List them under `collaborators` in a supervising agent.在一个主管智能体的 `collaborators` 下列出它们。
  3. Justify the split with a measurement, as in lab 12.像 lab 12 那样,用测量结果来证明拆分是合理的。
You are done when完成标志A compound question is answered with parts from both collaborators.一个复合问题的回答包含了来自两个协作者的内容。
07Evaluate with the kit's framework and your own gold sets用套件的评估框架和你自己的标准集做评估

Do this操作

  1. The kit includes an evaluation framework that compares simulated interactions with reference data.套件内置评估框架,把模拟的交互与参考数据进行比较。
  2. Keep your frozen questions from lab 11 as the reference data, outside the agent's reach.把 lab 11 的冻结问题作为参考数据,放在智能体接触不到的地方。
  3. The exact command was not on the pages read. Follow the evaluation page under sources.所查阅的页面上没有给出具体命令。请按“来源”里的评估页面操作。
You are done when完成标志You have a score for the agent before and after a change to its instructions.你有了智能体在修改指令前后的得分。

Sources来源