Skip to main content

Description

Datastores are the knowledgebases that your agent can access when answering queries. Files uploaded into a datastore are processed using Contextual’s multi-modal document understanding pipeline, which prepares documents in ways optimized for end-to-end RAG performance.
You must link at least one datastore to your agent, but you can specify more. If no datastore_id is provided, Contextual AI will automatically create an empty Datastore and configure your new Agent to use it.

Example

The following API call creates a specialized Agent and links it to the Datastore with the datastore_id of 3c90c3cc-0d44-4b50-8888-8dd25736052a:
curl --request POST \
  --url https://api.contextual.ai/v1/agents \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "system_prompt": "<string>",
  "no_retrieval_system_prompt": "<string>",
  "multiturn_system_prompt": "<string>",
  "filter_prompt": "<string>",
  "suggested_queries": [
    "<string>"
  ],
  "name": "<string>",
  "description": "",
  "template_name": "default",
  "datastore_ids": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ]
}'
Contextual AI will return the new agent’s id and its datastore_ids:
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "datastore_ids": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ]
}