@alexc This appears to be a bug in how OpenSearch Dashboard handles the conversation memory in OS2.18
I tested this in OS3.3 using the following configuration (wrapping flow agent around your conversational agent) and it works as expected
# For ease of testing
PUT /_cluster/settings
{
"persistent": {
"plugins.ml_commons.only_run_on_ml_node": false
}
}
# Create connector
POST /_plugins/_ml/connectors/_create
{
"name": "OpenAI Chat Connector",
"description": "Connector for OpenAI with conversation memory",
"version": 1,
"protocol": "http",
"parameters": {
"endpoint": "api.openai.com",
"model": "gpt-4o-mini"
},
"credential": {
"openAI_key": "openAI_KEY"
},
"actions": [
{
"action_type": "predict",
"method": "POST",
"url": "https://${parameters.endpoint}/v1/chat/completions",
"headers": {
"Authorization": "Bearer ${credential.openAI_key}",
"Content-Type": "application/json"
},
"request_body": "{ \"model\": \"${parameters.model}\", \"messages\": [{\"role\":\"system\",\"content\":\"You are a helpful assistant.\"},{\"role\":\"user\",\"content\":\"${parameters.prompt}\"}] }"
}
]
}
# Register a model
POST /_plugins/_ml/models/_register
{
"name": "OpenAI gpt-4o-mini",
"function_name": "remote",
"connector_id": "<connector_ID>"
}
# Register an agent (conversational_flow)
POST /_plugins/_ml/agents/_register
{
"name": "OpenAI Chat Agent",
"type": "conversational_flow",
"description": "Conversational agent with memory",
"app_type": "os_chat",
"memory": {
"type": "conversation_index"
},
"tools": [
{
"type": "MLModelTool",
"name": "chat_model",
"description": "General purpose chat model",
"parameters": {
"model_id": "<Model_ID>",
"prompt": "${parameters.chat_history:-}Human: ${parameters.question}\n\nAssistant:"
},
"include_output_in_agent_response": true
}
]
}
# Register a second agent (wrapper)
POST /_plugins/_ml/agents/_register
{
"name": "Dashboard Root Agent",
"type": "flow",
"description": "Root agent for Dashboard Assistant",
"tools": [
{
"type": "AgentTool",
"name": "LLMResponseGenerator",
"parameters": {
"agent_id": "<Agent_ID_conversational>"
},
"include_output_in_agent_response": true
}
],
"memory": {
"type": "conversation_index"
}
}
PUT /.plugins-ml-config/_doc/os_chat
{
"type": "os_chat_root_agent",
"configuration": {
"agent_id": "<Agent_ID_flow>"
}
}
You should now be able to ask AI Assistant multiple consecutive questions. Hope this helps.