The DSL query is being generated in a different format while executing the agent

@arnabmca2006 I think it might be what you’re looking for.

OpenAI: "response_filter": "$.choices[0].message.content"
Anthropic Claude (Amazon Bedrock Converse API): "response_filter": "$.output.message.content[0].text"

I used that with my agent

POST /_plugins/_ml/agents/_register
{
  "name": "Agentic Search with Claude 4",
  "type": "flow",
  "description": "A test agent for query planning.",
  "tools": [
    {
      "type": "QueryPlanningTool",
      "description": "A general tool to answer any question",
      "parameters": {
        "response_filter": "$.output.message.content[0].text",
        "model_id": "kIHzCJoBAjTizxdxU0T5",
        "generation_type": "user_templates",
        "search_templates": [
          {
            "template_id": "flower_species_search_template",
            "template_description": "This template searches for flowers that match the given species using a match query."
          },
          {
            "template_id": "flower_petal_length_range_template",
            "template_description": "This template searches for flowers within a specific petal length range using a range query."
          }
        ]
      }
    }
  ]
}

Running query with agent.

POST /_plugins/_ml/agents/3IEHCZoBAjTizxdxykSA/_execute
{
  "parameters": {
    "question": "How many iris flowers of type setosa are there?",
    "index_name": "iris-index"
  }
}

Response:

{
  "inference_results": [
    {
      "output": [
        {
          "name": "response",
          "result": """{"size":0.0,"query":{"term":{"species.keyword":"setosa"}},"aggs":{"setosa_count":{"value_count":{"field":"species.keyword"}}}}"""
        }
      ]
    }
  ]
}