Create an agent
POST/agents
Creates an agent from a prompt template and the placeholders that the template uses. Foundation4 validates the definition before storing the agent: the prompt contains at least one system message and one user message, the last message is a user message, every name in braces is a placeholder of the agent, no two placeholders share a name, every retrieval placeholder has a target that names a query placeholder, the search parameters are valid, and no placeholder names a search index in index or indexes. Agent executions run query, similarity, mmr, search, hybrid and history placeholders on the default search indexes of the pipeline of each request.
Permissions. Write on the agent object type (agents). The key that creates the agent receives read, write and execute permission on the new agent.
Agents and prompt templates describes prompt templates and placeholders.
Request
Responses
- 201
- 400
- 401
- 403
- 409
- 422
The agent was created. The body is the new agent, including the generated id, the include value of each message and every parameter of each retrieval placeholder.
The prompt template or a placeholder breaks a validation rule, with the reason in details.error: a missing system or user message or a last message that is not a user message (Invalid prompt type), a name in braces or a target without a matching placeholder (Invalid prompt), a search parameter out of range, such as a k of 0 (Invalid parameter), or a placeholder that is invalid as a whole (Invalid placeholder <name>, with the name in details.placeholder), such as a history placeholder with a target, a retrieval placeholder without a target, two placeholders with the same name or a placeholder that names a search index. The same status reports a body that is not valid JSON.
The authentication headers are missing or invalid, or the API key is inactive or expired. Errors lists the messages.
The key lacks write permission on the agents object type (Unauthorized: write access to Agent required), the license is not valid (Invalid license: <reason>) or the license limit for agents is reached (License limits exceeded for Agent).
Another agent already has this name (Conflict unique error).
The body does not match the request schema, for example a missing prompt, an unknown placeholder type or an unknown field.