docs/rest/agents/create.mdx
POST /api/projects/{project_name}/agents
This API endpoint creates an agent using the POST method.
In order to provide all tables from a database or all knowledge bases from a project, use the * wildcard like this:
"data": {
"knowledge_bases": ["my_project.*"],
"tables": ["my_data_source.*"]
}
curl --request POST \
--url http://127.0.0.1:47334/api/projects/mindsdb/agents \
--header 'Content-Type: application/json' \
--data '{
"agent": {
"name": "my_agent",
"model": {
"provider": "openai",
"model_name": "gpt-4o",
"api_key": "sk-xxx"
},
"data": {
"knowledge_bases": ["my_project.my_kb"],
"tables": ["my_data_source.my_table"]
},
"prompt_template": "my_project.my_kb stores documentation of MindsDB, my_data_source.my_table stores documentation of MindsDB"
}
}'
{
"id": 197,
"name": "my_agent",
"project_id": 1,
"created_at": "2025-07-09 12:58:24.868202",
"updated_at": "2025-07-09 12:58:24.868199",
"data": {
"knowledge_bases": [
"my_project.my_kb"
],
"tables": [
"my_data_source.my_table"
]
},
"model": {
"provider": "openai",
"model_name": "gpt-4o",
"api_key": "sk-xxx"
},
"prompt_template": "my_project.my_kb stores documentation of MindsDB, my_data_source.my_table stores documentation of MindsDB"
}