Skip to main content
PUT
/
agents
/
{agent_id}
Edit Agent
curl --request PUT \
  --url https://api.contextual.ai/v1/agents/{agent_id} \
  --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>"
  ],
  "agent_configs": {
    "retrieval_config": {
      "top_k_retrieved_chunks": 123,
      "lexical_alpha": 123,
      "semantic_alpha": 123
    },
    "filter_and_rerank_config": {
      "top_k_reranked_chunks": 123,
      "reranker_score_filter_threshold": 0,
      "rerank_instructions": "<string>",
      "default_metadata_filters": {
        "filters": [
          {
            "field": "field1",
            "operator": "equals",
            "value": "value1"
          }
        ],
        "operator": "AND"
      },
      "per_datastore_metadata_filters": {
        "d49609d9-61c3-4a67-b3bd-5196b10da560": {
          "filters": [
            {
              "field": "field1",
              "operator": "equals",
              "value": "value1"
            }
          ],
          "operator": "AND"
        }
      }
    },
    "generate_response_config": {
      "max_new_tokens": 123,
      "temperature": 123,
      "top_p": 123,
      "frequency_penalty": 123,
      "seed": 123,
      "calculate_groundedness": true,
      "avoid_commentary": false
    },
    "global_config": {
      "enable_rerank": true,
      "enable_filter": true,
      "enable_multi_turn": true,
      "should_check_retrieval_need": true
    },
    "reformulation_config": {
      "enable_query_expansion": true,
      "query_expansion_prompt": "<string>",
      "enable_query_decomposition": true,
      "query_decomposition_prompt": "<string>"
    },
    "acl_config": {
      "acl_active": true,
      "acl_yaml": "<string>"
    },
    "translation_config": {
      "translate_needed": true,
      "translate_confidence": 123
    }
  },
  "name": "<string>",
  "description": "<string>",
  "datastore_ids": [
    "3c90c3cc-0d44-4b50-8888-8dd25736052a"
  ],
  "llm_model_id": "<string>"
}'
{}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

agent_id
string<uuid>
required

ID of the agent to edit

Body

application/json
system_prompt
string

Instructions that your agent references when generating responses. Note that we do not guarantee that the system will follow these instructions exactly.

Maximum length: 8000
no_retrieval_system_prompt
string

Instructions on how the agent should respond when there are no relevant retrievals that can be used to answer a query.

Maximum length: 8000
multiturn_system_prompt
string

Instructions on how the agent should handle multi-turn conversations.

Maximum length: 8000
filter_prompt
string

The prompt to an LLM which determines whether retrieved chunks are relevant to a given query and filters out irrelevant chunks.

Maximum length: 8000
suggested_queries
string[]

These queries will show up as suggestions in the Contextual UI when users load the agent. We recommend including common queries that users will ask, as well as complex queries so users understand the types of complex queries the system can handle. The max length of all the suggested queries is 1000.

agent_configs
object

The following advanced parameters are experimental and subject to change.

name
string

Name of the agent

Required string length: 3 - 200
description
string

Description of the agent

Maximum length: 500
datastore_ids
string<uuid>[]

IDs of the datastore to associate with the agent.

llm_model_id
string

The model ID to use for generation. Tuned models can only be used for the agents on which they were tuned. If no model is specified, the default model is used. Set to default to switch from a tuned model to the default model.

Response

Successful Response

The response is of type object.

I