---
title: "Edit Agent"
method: PUT
path: "/agents/{agent_id}"
tags: ["/agents"]
---

# Edit Agent

`PUT /agents/{agent_id}`

Modify a given `Agent` to utilize the provided configuration.

Fields not included in the request body will not be modified.

## Path parameters

- `agent_id` string, uuid, required — ID of the agent to edit

## Request body

- ModifyAgentRequest
  - `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.
  - `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` AgentConfigs — Response to configs for different components
    - `retrieval_config` RetrievalConfig — Captures Retrieval configurations for an Agent
      - `top_k_retrieved_chunks` integer — The maximum number of retrieved chunks from the datastore.
      - `lexical_alpha` number — The weight of lexical search during retrieval
      - `semantic_alpha` number — The weight of semantic search during retrieval
    - `filter_and_rerank_config` FilterAndRerankConfig — Captures Filter and Rerank configurations for an Agent
      - `top_k_reranked_chunks` integer — The number of highest ranked chunks after reranking to be used
    - `generate_response_config` GenerateResponseConfig — Captures advance LLM configurations for an Agent
      - `max_new_tokens` integer — The maximum number of tokens the model can generate in a response.
      - `temperature` number — The sampling temperature, which affects the randomness in the response.
      - `top_p` number — A parameter for nucleus sampling, an alternative to `temperature` which also affects the randomness of the response.
      - `frequency_penalty` number — This parameter adjusts how the model treats repeated tokens during text generation.
      - `seed` integer — This parameter controls the randomness of how the model selects the next tokens during text generation.
    - `global_config` GlobalConfig — Captures global configs
      - `enable_rerank` boolean — Enables reranking of retrieved chunks
      - `enable_filter` boolean — Enables filtering of retrieved chunks with a separate LLM
      - `enable_multi_turn` boolean — Enables multi-turn conversations. This feature is currently experimental and will be improved.
  - `datastore_ids` string[] — 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 `200`

Successful Response

- EmptyResponse

## Other responses

- `422` — Validation Error

## Changes

- **2025-02-26** `5298551c424b` — 1 breaking, 2 info
  - the `system_prompt` request property's maxLength was decreased to `8000`
  - added the new optional request property `agent_configs`
  - the `datastore_ids` request property's minLength was decreased from `1` to `0`
- **2025-01-14** `4dd01a1cc34b` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/contextualai/apis/endpoints/changes/agents/:agent_id/put.md)

---

[API](https://skmtc.dev/contextualai/apis/endpoints.md) · [All operations](https://skmtc.dev/contextualai/apis/endpoints/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/contextualai/endpoints/revisions/5298551c424b/schema)
