Managing Agents Tutorial
This comprehensive tutorial covers all aspects of agent management in Knowledge Discovery, including creation, configuration, filtering, avatars, and deletion.
Prerequisites
- Valid access token (see Authentication)
- Discovery Agent Manager role or higher
The Agent management and Agent discovery endpoint paths are shared by both Knowledge Discovery implementations. Configure appKey, APP_KEY, and the token scope as follows:
| Knowledge Discovery implementation | Application key | Required token scope |
|---|---|---|
| ECE-powered | cin-ece-kd | hxp |
| Legacy | hxai-discovery | hxp iam.jti-capture |
ECE-powered Knowledge Discovery requires the new cin-ece-kd application key and does not require iam.jti-capture. The examples in this tutorial use an application-key variable because the /agent path does not identify the implementation.
If your HTTP client doesn't add the User-Agent header by default, make sure to include it in all requests below (e.g., User-Agent: PostmanRuntime/7.28.4) to avoid receiving a 403 Forbidden response.
Tutorial Overview
In this tutorial, you'll learn to:
- Create a new agent
- Create a Graph RAG agent (optional)
- Configure static and dynamic filters
- Configure guardrails for content safety
- Update agent configuration
- Upload and manage agent avatars
- List and retrieve agents
- Delete agents
Before creating an agent, you'll need to choose an LLM model. Use the GET /agent/models endpoint to retrieve available models with their current status (Active/Deprecated). For complete documentation, see the Agent API Reference.
Part 1: Create an Agent
Basic Agent Creation
Let's create a simple agent for a customer support use case.
For document retrieval, use staticFilterExpression for permanent restrictions and dynamicFilterTemplate for filters supplied at query time. See Configure Static and Dynamic Filters.
- HTTP
- curl
### Create Customer Support Agent
POST {{baseUrl}}/agent/agents
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
Content-Type: application/json
{
"name": "Customer Support Agent",
"description": "Specialized agent for customer support inquiries and troubleshooting",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"instructions": "You are a helpful customer support assistant. Provide clear, concise answers based on the documentation. If you cannot find relevant information, politely inform the customer and suggest contacting human support.",
"accessRights": [
{ "type": "Group", "id": "support-team-group-id" }
]
}
curl -X POST "${DISCOVERY_API_BASE_URL}/agent/agents" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Support Agent",
"description": "Specialized agent for customer support inquiries and troubleshooting",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"instructions": "You are a helpful customer support assistant. Provide clear, concise answers based on the documentation. If you cannot find relevant information, politely inform the customer and suggest contacting human support.",
"accessRights": [
{"type": "Group", "id": "support-team-group-id"}
]
}'
Understanding Required Parameters
| Parameter | Required | Description |
|---|---|---|
name | Yes | Display name for the agent (1-200 characters) |
description | Yes | Description of the agent's purpose (1-1000 characters) |
modelName | Yes | LLM model to use (e.g., amazon.nova-micro-v1:0) |
agentType | Yes | Retrieval strategy. Set explicitly to rag or graphRag. |
instructions | No | System prompt providing context and behavior guidelines |
accessRights | Yes | Array of access right objects controlling who can use this agent. See Access Rights Object below. |
avatarUrl | No | URL for the agent's avatar image |
staticFilterExpression | No | Permanent filters applied to all queries |
dynamicFilterTemplate | No | Template for runtime-provided filters |
guardrails | No | Array of guardrail objects to apply content filtering and safety measures |
ragParameters | No | RAG retrieval settings (limit, chunk merging, reranking) |
suggestedPrompts | No | Array of suggested prompts shown to users as conversation starters (max 6) |
enableFollowUpPrompts | No | Whether the agent suggests follow-up prompts after each answer. Defaults to false when omitted on agent creation. |
followUpPromptsLimit | No | Maximum number of follow-up prompts to suggest (1-10). Defaults to 3 when enableFollowUpPrompts is true and no value is provided. Ignored when enableFollowUpPrompts is not true. |
Access Rights Object
Each entry in the accessRights array has these fields:
| Field | Type | Description |
|---|---|---|
type | enum | The principal type. Values: User, Group |
id | UUID | The user or group identifier |
The optional ragParameters object fine-tunes the Retrieval-Augmented Generation (RAG) pipeline for the agent:
| Parameter | Type | Description |
|---|---|---|
limit | integer | Maximum number of document chunks to retrieve from the knowledge base |
adjacentChunkRange | integer | Number of adjacent chunks to include around each retrieved chunk for additional context |
adjacentChunkMerge | boolean | Whether to merge adjacent chunks into a single context block |
rerankerEnabled | boolean | Whether to apply a reranker model to re-score and reorder retrieved chunks for improved relevance |
rerankerTopN | integer | Maximum number of chunks to retain after reranking |
All ragParameters fields are optional — omit the object or individual fields to use system defaults.
Validation Rules
- Name: 1-200 characters, cannot be empty or whitespace only
- Description: 1-1000 characters, cannot be empty or whitespace only
- ModelName: Must be a supported model identifier. You can retrieve the list of available models using the
/modelsendpoint in the Agent API, optionally filtering with?agentType=ragor?agentType=graphRag. Each model includes astatusfield (enum:Active,Deprecated,Unavailable), an optionaleolDate, an optionalreplacementModelNamefor migrating off deprecated models, asupportedAgentTypesarray listing the agent types the model can be used with (e.g."rag","graphRag"), and adefaultForAgentTypesarray indicating which agent types use this model as the default. Ensure the model you select supports the intended agent type. - AgentType: Required. Use
ragorgraphRag. Omitting the field or setting it tonullreturns400 Bad Request. - AccessRights: User/Group IDs must be valid GUIDs
- SuggestedPrompts (when provided): Maximum 6 items;
ordervalues must be a continuous sequence starting from 1; eachquestionmust be unique and at most 150 characters - FollowUpPromptsLimit (when provided): Must be between 1 and 10
Part 1B: Create a Graph RAG Agent
Graph RAG agents use a knowledge graph domain for retrieval instead of the standard document-centric RAG approach. Use a Graph RAG agent when your workflow requires graph-based relationships between entities.
When to Use Graph RAG
- Use Graph RAG when you have a provisioned knowledge graph domain and need to retrieve entity relationships
- Use standard RAG (Part 1 above) for document-centric retrieval or when no knowledge graph domain exists
Graph RAG-Specific Fields
Use the following values when creating a Graph RAG agent:
| Field | Required | Description |
|---|---|---|
agentType | Yes | Retrieval strategy. Set to graphRag for Graph RAG agents or rag for standard agents. This field is required for both types. |
knowledgeGraphId | Yes | UUID of the provisioned knowledge graph |
All other fields (name, description, modelName, instructions, accessRights, ragParameters) work the same as for standard agents.
Example: Create a Graph RAG Agent
- HTTP
- curl
POST {{baseUrl}}/agent/agents
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
Content-Type: application/json
{
"name": "Claims Investigation Graph Agent",
"description": "Graph RAG agent for navigating claim relationships and related evidence.",
"modelName": "anthropic.claude-3-haiku-20240307-v1:0",
"instructions": "Answer using the configured knowledge graph. Explain relationship chains when important.",
"agentType": "graphRag",
"knowledgeGraphId": "11111111-2222-3333-4444-555555555555"
}
curl -X POST "${DISCOVERY_API_BASE_URL}/agent/agents" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "Claims Investigation Graph Agent",
"description": "Graph RAG agent for navigating claim relationships and related evidence.",
"modelName": "anthropic.claude-3-haiku-20240307-v1:0",
"instructions": "Answer using the configured knowledge graph.",
"agentType": "graphRag",
"knowledgeGraphId": "11111111-2222-3333-4444-555555555555"
}'
The Knowledge Discovery Agent API expects the knowledge graph to already exist. There is currently no endpoint to create or discover knowledgeGraphId values through this API.
Response Structure Differences
When retrieving answers from a Graph RAG agent (using the standard Q&A endpoints), the response includes graphReferences instead of documentReferences:
{
"id": "c9d6f822-e88c-48a7-bfb9-1f91e7214b40",
"question": "How is claim CLM-204 linked to vendor ACME Medical?",
"answer": "Claim CLM-204 is linked through invoice INV-1523...",
"graphReferences": [
{
"entityId": "claim-clm-204",
"entityType": "Claim",
"relationships": [
{
"relatedEntityId": "vendor-acme-medical",
"relatedEntityType": "Vendor",
"relationshipType": "submittedBy",
"rankScore": 0.98
}
]
}
]
}
Graph RAG agents are queried through the same endpoints as standard agents. See the Conversations Tutorial for information on multi-turn conversations with Graph RAG agents.
The graphDocumentReferences array returned by the Q&A endpoints groups knowledge graph node references by document. Each reference is discriminated by a schemaType field, which can be one of: Document, TextChunk, GlobalEntity, LocalEntity, BusinessObject, or MetadataKV. See the Agent API Reference for the full schema of each reference type.
Generate Suggested Prompts
Use POST /agent/agents/{agentId}/suggested-prompts/generate to generate conversation starters for an existing RAG or Graph RAG agent. The request has no body and requires permission to edit agents.
POST {{baseUrl}}/agent/agents/{{agentId}}/suggested-prompts/generate
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
The response contains one to six proposed questions with consecutive order values starting at 1:
{
"suggestedPrompts": [
{"question": "What is the document retention policy?", "order": 1},
{"question": "How do I request access to archived documents?", "order": 2}
],
"provenance": {
"origin": "ai-generated",
"fields": ["/suggestedPrompts"]
}
}
The optional provenance member identifies the generated collection. /suggestedPrompts is a JSON Pointer relative to the response body and covers every proposal. It does not verify accuracy.
Generation does not save the proposals or create a conversation. Review the questions and save the selected proposals through the update agent endpoint. Saved agent configuration does not automatically label manually entered or edited prompts as AI-generated. Generation failures use the existing error responses and omit provenance.
Part 2: Configure Static and Dynamic Filters
Filters control which documents the agent can access. There are two types:
Static Filters
Static filters are permanent and apply to all queries. Use these for:
- Department-specific restrictions
- Document type filtering
- Security level requirements
- HTTP
- curl
### Create Agent with Static Filters
POST {{baseUrl}}/agent/agents
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
Content-Type: application/json
{
"name": "Finance Department Agent",
"description": "Agent with access restricted to finance documents",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"accessRights": [
{"type": "Group", "id": "finance-group-id"}
],
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{
"field": "Department",
"type": "Text",
"operator": "Equals",
"value": "Finance"
},
{
"field": "Status",
"type": "Text",
"operator": "Any",
"values": ["Approved", "Published"]
}
]
}
}
curl -X POST "${DISCOVERY_API_BASE_URL}/agent/agents" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "Finance Department Agent",
"description": "Agent with access restricted to finance documents",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"accessRights": [
{"type": "Group", "id": "finance-group-id"}
],
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{
"field": "Department",
"type": "Text",
"operator": "Equals",
"value": "Finance"
},
{
"field": "Status",
"type": "Text",
"operator": "Any",
"values": ["Approved", "Published"]
}
]
}
}'
Dynamic Filter Templates
Dynamic filters allow users to provide filter values at query time. Use these for:
- Date range selections
- User-specific context
- Runtime parameters
Dynamic filter templates have a similar structure to static filters but do not contain values. The field definitions specify which fields can be filtered, but the actual values are provided when the question is submitted. This allows users to customize filtering at query time.
- HTTP
- curl
### Create Agent with Dynamic Filter Template
POST {{baseUrl}}/agent/agents
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
Content-Type: application/json
{
"name": "Document Search Agent",
"description": "Agent that allows users to filter by date and category",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"dynamicFilterTemplate": {
"logicalOperator": "And",
"conditions": [
{
"field": "CreatedDate",
"type": "Date"
},
{
"field": "Category",
"type": "Text"
}
]
}
}
curl -X POST "${DISCOVERY_API_BASE_URL}/agent/agents" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "Document Search Agent",
"description": "Agent that allows users to filter by date and category",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"dynamicFilterTemplate": {
"logicalOperator": "And",
"conditions": [
{
"field": "CreatedDate",
"type": "Date"
},
{
"field": "Category",
"type": "Text"
}
]
}
}'
Filter by Document ID
In ECE-powered Knowledge Discovery, __cinId__ filters by the document identifier from the external system, stored as cin_id. __sourceId__ filters by cin_sourceId. Use the exact stored IDs as text; Content Lake's sys_id is a separate identifier.
Use Equals with value for one ID or Any with values for up to 20 IDs. External document IDs can repeat across sources, so pair the source and document conditions with And.
Static filter
Add this property when creating or updating an agent to restrict all queries to documents 101 and 102 from source s1. Replace the IDs with your stored values.
{
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{"field": "__sourceId__", "type": "Text", "operator": "Equals", "value": "s1"},
{"field": "__cinId__", "type": "Text", "operator": "Any", "values": ["101", "102"]}
]
}
}
Dynamic filter
Configure the agent's template without operator, value, or values:
{
"dynamicFilterTemplate": {
"logicalOperator": "And",
"conditions": [
{"field": "__sourceId__", "type": "Text"},
{"field": "__cinId__", "type": "Text"}
]
}
}
Provide the IDs in dynamicFilter when starting a conversation:
{
"question": "Summarize these documents from source s1.",
"dynamicFilter": {
"logicalOperator": "And",
"conditions": [
{"field": "__sourceId__", "type": "Text", "operator": "Equals", "value": "s1"},
{"field": "__cinId__", "type": "Text", "operator": "Any", "values": ["101", "102"]}
]
}
}
Static and dynamic filters are combined with And, so a dynamic filter can only narrow the static selection.
For different document sets across sources, combine each source/document pair with And, then join those groups with Or. This works in both static and dynamic filters. Separate source and document lists allow unintended combinations.
Filter Syntax Reference
logicalOperator (enum)
The logicalOperator field on a filter group controls how its conditions are combined:
| Value | Description |
|---|---|
And | All conditions must be true |
Or | At least one condition must be true |
Not | Negates the conditions |
type (enum)
The type field on each condition specifies the data type of the field being filtered:
| Value | Description |
|---|---|
Text | String values |
Number | Numeric values (integers, decimals) |
Date | ISO 8601 date/datetime values |
Boolean | True/false values |
operator (enum)
The operator field on each condition specifies the comparison to apply:
| Value | Applies To | Description | Example |
|---|---|---|---|
Equals | Text, Number, Date, Boolean | Exact match | "Status" Equals "Active" |
NotEquals | Text, Number, Date | Not equal to | "Status" NotEquals "Deleted" |
Contains | Text | String contains substring | "Title" Contains "Report" |
Like | Text | Pattern matching with wildcards | "Name" Like "%invoice%" |
Any | Text, Number | Value in list | "Status" Any ["Active", "Pending"] |
GreaterThan | Number, Date | Greater than | "Amount" GreaterThan 1000 |
LessThan | Number, Date | Less than | "CreatedDate" LessThan "2024-01-01" |
GreaterThanOrEquals | Number, Date | Greater than or equals | "Priority" GreaterThanOrEquals 3 |
LessThanOrEquals | Number, Date | Less than or equals | "UpdatedDate" LessThanOrEquals "2024-12-31" |
Complex Filter Examples
{
"logicalOperator": "AND",
"conditions": [
{
"field": "primary_type",
"type": "text",
"operator": "any",
"values": ["Document", "File"]
},
{
"field": "created",
"type": "date",
"operator": "greaterThan",
"value": "2023-01-01"
},
{
"logicalOperator": "NOT",
"conditions": [
{
"field": "is_trashed",
"type": "boolean",
"operator": "equals",
"value": true
}
]
}
]
}
Static and Dynamic Filtering Example
Combine static and dynamic filters with nested logic:
- HTTP
- curl
### Create Agent with Complex Filtering
POST {{baseUrl}}/agent/agents
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
Content-Type: application/json
{
"name": "Compliance Document Agent",
"description": "Agent for compliance documents with complex filtering",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{
"field": "Department",
"type": "Text",
"operator": "Equals",
"value": "Compliance"
},
{
"field": "ApprovalStatus",
"type": "Text",
"operator": "Equals",
"value": "Approved"
}
]
},
"dynamicFilterTemplate": {
"logicalOperator": "And",
"conditions": [
{
"field": "PublishedDate",
"type": "Date"
},
{
"field": "RiskLevel",
"type": "Number"
},
{
"field": "Category",
"type": "Text"
}
]
}
}
curl -X POST "${DISCOVERY_API_BASE_URL}/agent/agents" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "Compliance Document Agent",
"description": "Agent for compliance documents with complex filtering",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{
"field": "Department",
"type": "Text",
"operator": "Equals",
"value": "Compliance"
},
{
"field": "ApprovalStatus",
"type": "Text",
"operator": "Equals",
"value": "Approved"
}
]
},
"dynamicFilterTemplate": {
"logicalOperator": "And",
"conditions": [
{
"field": "PublishedDate",
"type": "Date"
},
{
"field": "RiskLevel",
"type": "Number"
},
{
"field": "Category",
"type": "Text"
}
]
}
}'
Part 3: Configure Guardrails
Guardrails provide content filtering and safety measures for agent responses. They help ensure that agent interactions remain appropriate and aligned with organizational policies.
Available Guardrails
To get the list of available guardrails, use the GET /agent/guardrails endpoint:
- HTTP
- curl
### Get Available Guardrails
GET {{baseUrl}}/agent/guardrails
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
curl -X GET "${DISCOVERY_API_BASE_URL}/agent/guardrails" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}"
The response contains guardrail groups with available guardrails:
{
"guardrailGroups": [
{
"displayName": "Profanity",
"description": "Filters profane content.",
"guardrails": [
{"name": "HAIP-Profanity", "severity": null, "isRecommended": false}
]
},
{
"displayName": "Violence",
"description": "Filters content related to violence.",
"guardrails": [
{"name": "HAIP-Violence-Low", "severity": "low", "isRecommended": false},
{"name": "HAIP-Violence-Medium", "severity": "medium", "isRecommended": false},
{"name": "HAIP-Violence-High", "severity": "high", "isRecommended": false}
]
},
{
"displayName": "Contextual grounding",
"description": "Provides contextual grounding validation for responses.",
"guardrails": [
{"name": "HAIP-Contextual-Grounding", "severity": null, "isRecommended": false}
]
}
]
}
Create Agent with Guardrails
- HTTP
- curl
### Create Agent with Guardrails
POST {{baseUrl}}/agent/agents
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
Content-Type: application/json
{
"name": "Safe Customer Support Agent",
"description": "Customer support agent with content safety guardrails",
"modelName": "bedrock-amazon-nova-micro",
"agentType": "rag",
"guardrails": [
{"name": "HAIP-Contextual-Grounding"},
{"name": "HAIP-Profanity"},
{"name": "HAIP-Violence-High"}
]
}
curl -X POST "${DISCOVERY_API_BASE_URL}/agent/agents" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "Safe Customer Support Agent",
"description": "Customer support agent with content safety guardrails",
"modelName": "bedrock-amazon-nova-micro",
"agentType": "rag",
"guardrails": [
{"name": "HAIP-Contextual-Grounding"},
{"name": "HAIP-Profanity"},
{"name": "HAIP-Violence-High"}
]
}'
Guardrail Blocking Behavior
When an active guardrail blocks a question or its generated answer, the API returns a standard response with a fixed message instead of the actual answer:
"This request was limited by one or more guardrails. Try rephrasing it, or contact support if assistance is needed."
In the response, the relevant status field is set to Blocked:
- For single-shot questions:
responseCompletenessisBlocked - For conversations:
statusisBlocked
This allows your application to detect blocked responses and surface appropriate messaging to the user.
Part 4: Update Agent Configuration
Agents can be updated using the PUT endpoint. This is a full replacement operation.
- HTTP
- curl
### Update Agent Configuration
PUT {{baseUrl}}/agent/agents/{{agentId}}
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
Content-Type: application/json
{
"name": "Customer Support Agent (Updated)",
"description": "Enhanced customer support agent with expanded capabilities",
"modelName": "amazon.nova-micro-v1:0",
"instructions": "You are an expert customer support assistant with access to comprehensive product documentation. Provide detailed, accurate answers and include relevant links when appropriate.",
"accessRights": [
{"type": "Group", "id": "support-team-group-id"},
{"type": "Group", "id": "customer-success-group-id"}
],
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{
"field": "Category",
"type": "Text",
"operator": "Any",
"values": ["Support", "FAQ", "Troubleshooting"]
}
]
},
"guardrails": [
{"name": "HAIP-Contextual-Grounding"},
{"name": "HAIP-Profanity"}
]
}
AGENT_ID="your-agent-id-here"
curl -X PUT "${DISCOVERY_API_BASE_URL}/agent/agents/${AGENT_ID}" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Support Agent (Updated)",
"description": "Enhanced customer support agent with expanded capabilities",
"modelName": "amazon.nova-micro-v1:0",
"instructions": "You are an expert customer support assistant with access to comprehensive product documentation. Provide detailed, accurate answers and include relevant links when appropriate.",
"accessRights": [
{"type": "Group", "id": "support-team-group-id"},
{"type": "Group", "id": "customer-success-group-id"}
],
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{
"field": "Category",
"type": "Text",
"operator": "Any",
"values": ["Support", "FAQ", "Troubleshooting"]
}
]
},
"guardrails": [
{"name": "HAIP-Contextual-Grounding"},
{"name": "HAIP-Profanity"}
]
}'
Each update creates a new version of the agent. The version number increments automatically. Previous versions are retained but marked as not latest.
Part 5: Upload and Manage Agent Avatars
Agents can have custom avatar images. Avatars are uploaded separately and referenced by URL.
Upload Avatar (Pre-signed URL method)
- HTTP
- curl
### Upload Agent Avatar (Update with Avatar URL)
PUT {{baseUrl}}/agent/agents/{{agentId}}
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
Content-Type: application/json
{
"name": "Customer Support Agent",
"description": "Agent with custom avatar",
"modelName": "amazon.nova-micro-v1:0",
"avatarUrl": "https://your-storage.com/avatars/agent-avatar.png"
}
curl -X PUT "${DISCOVERY_API_BASE_URL}/agent/agents/${AGENT_ID}" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "Customer Support Agent",
"description": "Agent with custom avatar",
"modelName": "amazon.nova-micro-v1:0",
"avatarUrl": "https://your-storage.com/avatars/agent-avatar.png"
}'
Retrieve Avatar with Pre-signed URL
When listing or retrieving agents, you can request pre-signed URLs for avatars:
- HTTP
- curl
### Retrieve Agent with Pre-signed Avatar URL
GET {{baseUrl}}/agent/agents/{{agentId}}?includePresignedUrl=true
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
curl -X GET "${DISCOVERY_API_BASE_URL}/agent/agents/${AGENT_ID}?includePresignedUrl=true" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}"
Part 6: List and Retrieve Agents
Every agent configuration and list entry includes a non-null agentType value: rag or graphRag.
List All Accessible Agents
- HTTP
- curl
### List All Accessible Agents
GET {{baseUrl}}/agent/agents
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
curl -X GET "${DISCOVERY_API_BASE_URL}/agent/agents" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}"
Response Structure:
[
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Customer Support Agent",
"description": "Specialized agent for customer support inquiries",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"avatarUrl": "https://example.com/avatar.png",
"instructions": "You are a helpful customer support assistant...",
"accessRights": [
{
"type": "Group",
"id": "group-id-123"
},
{
"type": "User",
"id": "user-id-456"
}
],
"version": 2,
"latest": true,
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{
"field": "Department",
"type": "Text",
"operator": "Equals",
"value": "Support"
}
]
},
"dynamicFilterTemplate": {
"logicalOperator": "And",
"conditions": [
{
"field": "CreatedDate",
"type": "Date"
}
]
},
"guardrails": [
{"name": "HAIP-Contextual-Grounding"},
{"name": "HAIP-Profanity"}
]
}
]
Retrieve Specific Agent
- HTTP
- curl
### Retrieve Specific Agent
GET {{baseUrl}}/agent/agents/{{agentId}}
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
curl -X GET "${DISCOVERY_API_BASE_URL}/agent/agents/${AGENT_ID}" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}"
Response Structure:
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Customer Support Agent",
"description": "Specialized agent for customer support inquiries",
"modelName": "amazon.nova-micro-v1:0",
"agentType": "rag",
"avatarUrl": "https://example.com/avatar.png",
"instructions": "You are a helpful customer support assistant. Provide clear, concise answers based on the documentation.",
"accessRights": [
{
"type": "Group",
"id": "group-id-123"
},
{
"type": "User",
"id": "user-id-456"
}
],
"version": 2,
"latest": true,
"staticFilterExpression": {
"logicalOperator": "And",
"conditions": [
{
"field": "Department",
"type": "Text",
"operator": "Equals",
"value": "Support"
}
]
},
"dynamicFilterTemplate": {
"logicalOperator": "And",
"conditions": [
{
"field": "CreatedDate",
"type": "Date"
},
{
"field": "Category",
"type": "Text"
}
]
},
"guardrails": [
{"name": "HAIP-Contextual-Grounding"},
{"name": "HAIP-Profanity"}
]
}
Part 7: Delete Agent
- HTTP
- curl
### Delete Agent
DELETE {{baseUrl}}/agent/agents/{{agentId}}
Authorization: Bearer {{accessToken}}
Hxp-App: {{appKey}}
curl -X DELETE "${DISCOVERY_API_BASE_URL}/agent/agents/${AGENT_ID}" \
-H "Authorization: Bearer ${DISCOVERY_ACCESS_TOKEN}" \
-H "Hxp-App: ${APP_KEY}"
Deleting an agent does not delete historical questions/answers associated with it. However, new questions cannot be submitted to a deleted agent.
Best Practices
1. Idempotency Considerations
The PUT endpoint replaces the entire agent configuration. Always:
- Retrieve current configuration first
- Modify only what needs changing
- Send complete updated configuration
2. Version Management
- Each update increments the version number
- Previous versions are retained
- Always use the latest version for new questions
3. Error Handling
Always implement comprehensive error handling:
- 400 Bad Request - Validation errors (check request payload)
- 403 Forbidden - Insufficient permissions
- 404 Not Found - Agent doesn't exist
- 409 Conflict - Concurrent modification (retry with latest version)
Summary
In this tutorial, you learned how to:
✅ Create agents with comprehensive configurations
✅ Configure static filters for permanent restrictions
✅ Set up dynamic filter templates for runtime filtering
✅ Configure guardrails for content safety and moderation
✅ Update agent configurations safely
✅ Manage agent avatars
✅ List and retrieve agents
✅ Delete agents properly