Link Search Menu Expand Document Documentation Menu

Flow agents

Introduced 2.13

A flow agent is configured with a set of tools that it runs in order. For example, the following agent runs the VectorDBTool and then the MLModelTool. The agent coordinates the tools so that one tool’s output can become another tool’s input. In this example, the VectorDBTool queries the k-NN index, and the agent passes its output ${parameters.VectorDBTool.output} to the MLModelTool as context along with the ${parameters.question} (see the prompt parameter):

POST /_plugins/_ml/agents/_register
{
  "name": "Test_Agent_For_RAG",
  "type": "flow",
  "description": "this is a test agent",
  "tools": [
    {
      "type": "VectorDBTool",
      "parameters": {
        "model_id": "YOUR_TEXT_EMBEDDING_MODEL_ID",
        "index": "my_test_data",
        "embedding_field": "embedding",
        "source_field": ["text"],
        "input": "${parameters.question}"
      }
    },
    {
      "type": "MLModelTool",
      "description": "A general tool to answer any question",
      "parameters": {
        "model_id": "YOUR_LLM_MODEL_ID",
        "prompt": "\n\nHuman:You are a professional data analyst. You will always answer a question based on the given context first. If the answer is not directly shown in the context, you will analyze the data and find the answer. If you don't know the answer, just say you don't know. \n\n Context:\n${parameters.VectorDBTool.output}\n\nHuman:${parameters.question}\n\nAssistant:"
      }
    }
  ]
}

For more information about the Register Agent API request fields, see Request body fields.

For a step-by-step tutorial, see Agents and tools tutorial.

Using external MCP tools

Introduced 3.8

Starting in OpenSearch 3.8, flow agents can call external MCP server tools in a fixed pipeline alongside OpenSearch tools such as MLModelTool. Configure parameters.mcp_connectors and declare each MCP tool explicitly in the tools array using McpStreamableHttpTool or McpSseTool. For setup steps and examples, see Using MCP tools with flow agents and conversational flow agents.

Next steps

350 characters left

Have a question? .

Want to contribute? or .