This creates a specialized RAG Agent which queries over one or multiple Datastores to retrieve relevant data on which its generations are grounded.
Retrieval and generation parameters are defined in the provided Agent configuration.
Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: “This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.”
Instructions that your agent references when generating responses. Note that we do not guarantee that the system will follow these instructions exactly.
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.
IDs of the datastores associated with the agent. If no datastore was provided as part of the request, this is a singleton list containing the ID of the automatically created datastore.
Was this page helpful?
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Contextual AI Documentation","colors":{"primary":"#2e70ff","light":"#2e70ff","dark":"#2e70ff"},"logo":{"light":"https://mintcdn.com/contextualai/hbpTLlKqktq8fCLj/logo/light.svg?fit=max\u0026auto=format\u0026n=hbpTLlKqktq8fCLj\u0026q=85\u0026s=049c4ad3c96c7cc618c2d6b183e5a683","dark":"https://mintcdn.com/contextualai/hbpTLlKqktq8fCLj/logo/dark.svg?fit=max\u0026auto=format\u0026n=hbpTLlKqktq8fCLj\u0026q=85\u0026s=84c3b689b03ff7f98d343d078a9c3383","href":"https://contextual.ai"},"favicon":"https://mintcdn.com/contextualai/JZazZVco2S8P3AG4/favicon.svg?fit=max\u0026auto=format\u0026n=JZazZVco2S8P3AG4\u0026q=85\u0026s=0fe0b7d5cdbba2f5ffbe775459bc3911","appearance":{"default":"light","strict":true},"navbar":{"primary":{"type":"button","label":"Login","href":"https://app.contextual.ai"}},"footer":{"socials":{"x":"https://x.com/contextualai","github":"https://github.com/ContextualAI","linkedin":"https://www.linkedin.com/company/contextualai"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"contextualai","hasAudioNarration":false,"actualSubdomain":"contextualai","customDomains":["docs.contextual.ai"],"gitSource":{"type":"github","owner":"contextualai","repo":"mintlify","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"issues":true},"entitlements":{"AI_CHAT":{"status":"DISABLED"}},"buildId":"6ae925ddec046ea6c84b1a57:success","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"API","count":66},{"language":"default","tag":"Guides","count":43},{"language":"default","tag":"Reference","count":42},{"language":"default","tag":"Agent Configs","count":26},{"language":"default","tag":"Agent Composer","count":21},{"language":"default","tag":"/extract","count":15},{"language":"default","tag":"For Developers","count":13},{"language":"default","tag":"Examples","count":13},{"language":"default","tag":"/agents","count":11},{"language":"default","tag":"Data Sources","count":10}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"scripts/assistant.css","content":"[data-search-button],button[aria-label*=\"Search\"],button[aria-label*=\"search\"],.search-button,#search-button,[class*=\"SearchButton\"],[class*=\"searchButton\"]{display:none!important}.contextual-ai-keyword-search-results{position:absolute;background:white;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 10px 40px rgba(0, 0, 0, 0.15);z-index:1001;max-height:calc(100vh - 10rem);overflow-y:auto;display:none;animation:keywordSearchFadeIn 0.2s ease-out}@keyframes keywordSearchFadeIn{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.contextual-ai-keyword-search-results.visible{display:block}.contextual-ai-keyword-search-results::-webkit-scrollbar{width:6px}.contextual-ai-keyword-search-results::-webkit-scrollbar-track{background:transparent}.contextual-ai-keyword-search-results::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.contextual-ai-keyword-results-container{padding:6px}.contextual-ai-keyword-header{padding:12px 16px 8px 16px;border-bottom:1px solid #f3f4f6}.contextual-ai-keyword-count{font-size:11px;color:#9ca3af;font-weight:500;text-transform:uppercase;letter-spacing:0.5px}.contextual-ai-keyword-result-item{cursor:pointer;position:relative;border-radius:12px;display:flex;gap:12px;padding:10px 10px;align-items:center;transition:all 0.15s ease;text-decoration:none;color:inherit;margin-bottom:2px}.contextual-ai-keyword-result-item:last-child{margin-bottom:8px}.contextual-ai-keyword-result-item:hover{background:#f9fafb}.contextual-ai-keyword-result-icon{flex-shrink:0;width:16px;height:16px;color:#6b7280}.contextual-ai-keyword-result-icon.api-icon{color:#2e70ff}.contextual-ai-keyword-result-content{display:flex;flex-direction:column;flex:1;min-width:0;gap:4px}.contextual-ai-keyword-breadcrumbs{display:flex;gap:4px;align-items:center;min-width:0;flex:1}.contextual-ai-keyword-breadcrumb-item{font-size:12px;color:#9ca3af;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex-shrink:1;min-width:0}.contextual-ai-keyword-breadcrumb-item:first-child{flex-shrink:0}.contextual-ai-keyword-breadcrumb-separator{flex-shrink:0;width:12px;height:12px;color:#9ca3af}.contextual-ai-keyword-title-row{display:flex;gap:8px;align-items:center}.contextual-ai-keyword-method-pill{font-weight:bold;font-size:11px;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;border-radius:4px;padding:2px 6px;flex-shrink:0}.contextual-ai-keyword-method-pill.get{background:rgba(34, 197, 94, 0.2);color:#15803d}.contextual-ai-keyword-method-pill.post{background:rgba(59, 130, 246, 0.2);color:#1e40af}.contextual-ai-keyword-method-pill.put{background:rgba(251, 146, 60, 0.2);color:#c2410c}.contextual-ai-keyword-method-pill.delete{background:rgba(239, 68, 68, 0.2);color:#b91c1c}.contextual-ai-keyword-title{font-size:14px;line-height:18px;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.contextual-ai-keyword-description{font-size:12px;color:#6b7280;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.contextual-ai-keyword-result-item mark{background:transparent}.contextual-ai-keyword-result-item mark b{font-weight:500;color:#2e70ff}.contextual-ai-keyword-result-chevron{flex-shrink:0;width:20px;height:20px;color:transparent;transition:color 0.15s ease}.contextual-ai-keyword-result-item:hover .contextual-ai-keyword-result-chevron{color:#9ca3af}.contextual-ai-keyword-empty{padding:32px 16px;text-align:center;color:#9ca3af;font-size:14px}.contextual-ai-floating-bar .contextual-ai-keyword-search-results{top:calc(100% + 8px);left:0;right:0;min-width:500px}.contextual-ai-keyword-search-results.contextual-ai-keyword-inline{position:relative;width:100%;max-width:100%;box-sizing:border-box;background:white;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 4px 20px rgba(0, 0, 0, 0.08);max-height:380px;overflow-y:auto;overflow-x:hidden;margin-top:12px;display:block;animation:keywordSearchFadeIn 0.2s ease-out}@media (max-width: 840px){.contextual-ai-floating-bar .contextual-ai-keyword-search-results{min-width:100%}.contextual-ai-floating-bar{display:none!important}}.contextual-ai-mobile-icon{display:none;position:fixed;top:16px;right:52px;z-index:1000;background:transparent;padding:6px;cursor:pointer;color:#374151;align-items:center;justify-content:center}@media (max-width: 840px){.contextual-ai-mobile-icon{display:flex}}.contextual-ai-floating-bar{position:fixed;top:4px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:10px;background:white;border:1px solid #e5e7eb;border-radius:20px;padding:4px 16px;box-shadow:0 4px 12px rgba(0, 0, 0, 0.1);z-index:1000;max-width:480px;width:calc(100% - 48px);backdrop-filter:blur(10px);opacity:0;animation:floatingBarFadeIn 0.3s ease-out forwards;animation-delay:0.1s}@keyframes floatingBarFadeIn{from{opacity:0}to{opacity:1}}.contextual-ai-floating-bar input{flex:1;border:none;outline:none;font-size:14px;background:transparent;color:#1f2937;font-family:inherit}.contextual-ai-floating-bar input::placeholder{color:#9ca3af}.contextual-ai-floating-bar:focus-within{border-color:#9ca3af;box-shadow:0 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 3px rgba(156, 163, 175, 0.15)}.contextual-ai-floating-trigger{background:#2e70ff;color:white;border:none;padding:8px 16px;border-radius:16px;cursor:pointer;font-size:13px;font-weight:500;transition:all 0.2s ease;white-space:nowrap;font-family:inherit;transform:scale(0.90);transform-origin:right center}.contextual-ai-floating-trigger:hover{background:#1e5fef}#body-content.assistant-open{display:flex!important;flex-direction:row;max-width:none;padding-right:0!important}#body-content.assistant-open>div.w-full,#body-content.assistant-open>div[class*=\"w-full\"]{flex:1 1 0%;min-width:0;width:auto}#body-content.assistant-open>#content-area{flex:1 1 0%;min-width:0;width:auto}#body-content.assistant-open #table-of-contents-layout{display:none!important}.contextual-ai-panel{width:0;min-width:0;max-width:800px;height:calc(100vh - 96px);background:white;box-shadow:-2px 0 12px rgba(0, 0, 0, 0.1);z-index:50;display:flex;flex-direction:column;flex-shrink:0;overflow:hidden;transition:width 0.3s cubic-bezier(0.4, 0, 0.2, 1), min-width 0.3s cubic-bezier(0.4, 0, 0.2, 1);border-left:1px solid #e5e7eb;position:sticky;top:96px}.contextual-ai-panel.open{width:380px}@media (max-width: 768px){.contextual-ai-panel{position:fixed;top:0;right:0;width:0;height:100vh;height:100dvh;z-index:2000}.contextual-ai-panel.open{width:100%;min-width:100%}}.contextual-ai-panel-resize-handle{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:ew-resize;background:transparent;z-index:5;transition:background 0.2s ease}.contextual-ai-panel-resize-handle:hover,.contextual-ai-panel-resize-handle.resizing{background:rgba(46, 112, 255, 0.3)}@media (max-width: 768px){.contextual-ai-panel-resize-handle{display:none}}.contextual-ai-panel-header{padding:16px 20px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:white;flex-shrink:0}.contextual-ai-panel-title{display:flex;flex-direction:column;align-items:flex-start;gap:2px;font-size:18px;font-weight:600;color:#1f2937}.contextual-ai-panel-subtitle{margin:0;font-size:12px;font-weight:400;color:#6b7280}.contextual-ai-header-actions{display:flex;align-items:center;gap:4px}.contextual-ai-header-btn{background:transparent;border:none;cursor:pointer;padding:8px;border-radius:6px;color:#6b7280;transition:all 0.2s ease;display:flex;align-items:center;justify-content:center}.contextual-ai-header-btn:hover{background:#f3f4f6;color:#374151}.contextual-ai-header-btn[data-tooltip]{position:relative}.contextual-ai-header-btn[data-tooltip]::after{content:attr(data-tooltip);position:absolute;top:calc(100% + 8px);left:50%;transform:translateX(-50%);background:#f3f4f6;color:#1f2937;font-size:11px;padding:3px 7px;border-radius:4px;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity 0.4s ease;will-change:opacity;z-index:9999}.contextual-ai-header-btn[data-tooltip]:hover::after{opacity:1}.contextual-ai-header-btn:active{transform:scale(0.95)}.contextual-ai-input-container{display:flex;align-items:flex-end;gap:12px;padding:16px 20px;background:white;border-top:1px solid #e5e7eb;flex-shrink:0}.contextual-ai-input-container textarea{flex:1;min-height:44px;max-height:120px;padding:12px 16px;border:1px solid #e5e7eb;border-radius:12px;font-size:14px;line-height:1.5;font-family:inherit;resize:none;outline:none;background:#f9fafb;color:#1f2937;transition:border-color 0.2s ease, box-shadow 0.2s ease}.contextual-ai-input-container textarea::placeholder{color:#9ca3af}.contextual-ai-input-container textarea:focus{border-color:#9ca3af;background:white;box-shadow:0 0 0 3px rgba(156, 163, 175, 0.15)}.contextual-ai-send{display:flex;align-items:center;justify-content:center;width:44px;height:44px;background:#1f2937;color:white;border:none;border-radius:12px;cursor:pointer;transition:all 0.2s ease;flex-shrink:0}.contextual-ai-send:hover{background:#374151;transform:scale(1.02)}.contextual-ai-send:active{transform:scale(0.98)}.contextual-ai-send:disabled{background:#d1d5db;cursor:not-allowed}.contextual-ai-send svg{width:18px;height:18px}.contextual-ai-messages{flex:1;overflow-y:auto;padding:20px;display:flex;flex-direction:column;gap:16px;background:#f9fafb}.contextual-ai-messages::-webkit-scrollbar{width:6px}.contextual-ai-messages::-webkit-scrollbar-track{background:transparent}.contextual-ai-messages::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.contextual-ai-messages::-webkit-scrollbar-thumb:hover{background:#9ca3af}.contextual-ai-welcome{display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:40px 20px;color:#6b7280}.contextual-ai-welcome h3{margin:0 0 8px 0;font-size:18px;font-weight:600;color:#1f2937}.contextual-ai-welcome p{margin:0;font-size:14px;color:#6b7280}.contextual-ai-message{display:flex;flex-direction:column;animation:messageSlideIn 0.3s ease-out}@keyframes messageSlideIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.contextual-ai-message-user{align-items:flex-end}.contextual-ai-message-assistant{align-items:flex-start}.contextual-ai-message-content{max-width:100%;padding:12px 16px;border-radius:12px;font-size:14px;line-height:1.5;word-wrap:break-word}.contextual-ai-message-user .contextual-ai-message-content{background:#f3f4f6;color:#1f2937;border:1px solid #e5e7eb;border-bottom-right-radius:4px}.contextual-ai-message-assistant .contextual-ai-message-content{background:white;color:#1f2937;border:1px solid #e5e7eb;border-bottom-left-radius:4px}.contextual-ai-message-content code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;font-size:0.9em;color:#1f2937;border:1px solid #e5e7eb}.contextual-ai-message-user .contextual-ai-message-content code{background:rgba(0, 0, 0, 0.06);color:#1f2937}.contextual-ai-message-content pre{background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;padding:16px;overflow-x:auto;margin:12px 0;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;font-size:13px;line-height:1.6;position:relative}.contextual-ai-message-content pre code{background:transparent;padding:0;border-radius:0;border:none;display:block;color:#1f2937}.contextual-ai-code-copy-btn{position:absolute;top:8px;right:8px;background:white;border:1px solid #d1d5db;border-radius:4px;padding:4px 8px;font-size:11px;color:#6b7280;cursor:pointer;transition:all 0.2s ease;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif}.contextual-ai-code-copy-btn:hover{background:#f3f4f6;color:#374151;border-color:#9ca3af}.contextual-ai-code-copy-btn.copied{color:#059669;border-color:#059669}.contextual-ai-table-wrapper{width:100%;overflow-x:auto;margin:12px 0;-webkit-overflow-scrolling:touch}.contextual-ai-table{width:max-content;min-width:100%;border-collapse:collapse;font-size:14px;border:1px solid #e5e7eb;border-radius:6px;overflow:hidden}.contextual-ai-table thead{background:#f9fafb}.contextual-ai-table th{padding:10px 12px;font-weight:600;text-align:left;border-bottom:2px solid #e5e7eb;color:#374151}.contextual-ai-table td{padding:10px 12px;border-bottom:1px solid #e5e7eb;color:#1f2937}.contextual-ai-table tbody tr:last-child td{border-bottom:none}.contextual-ai-table tbody tr:hover{background:#f9fafb}.contextual-ai-loading{display:flex;gap:4px;align-items:center}.contextual-ai-loading span{width:8px;height:8px;border-radius:50%;background:#9ca3af;animation:loadingDot 1.4s infinite ease-in-out}.contextual-ai-loading span:nth-child(1){animation-delay:-0.32s}.contextual-ai-loading span:nth-child(2){animation-delay:-0.16s}@keyframes loadingDot{0%,80%,100%{transform:scale(0.8);opacity:0.5}40%{transform:scale(1);opacity:1}}.contextual-ai-sources{margin-top:12px;margin-bottom:8px}.contextual-ai-sources-toggle{display:flex;align-items:center;gap:6px;background:none;border:none;padding:0;font-size:11px;color:#9ca3af;cursor:pointer;transition:color 0.2s ease;font-family:inherit}.contextual-ai-sources-toggle:hover{color:#6b7280}.contextual-ai-sources-chevron{transition:transform 0.2s ease}.contextual-ai-sources.expanded .contextual-ai-sources-chevron{transform:rotate(180deg)}.contextual-ai-sources-content{display:none;flex-wrap:wrap;gap:6px;margin-top:8px;padding-left:18px}.contextual-ai-sources.expanded .contextual-ai-sources-content{display:flex}.contextual-ai-source-item{background:transparent;border:none;padding:0;font-size:12px;color:#9ca3af;cursor:pointer;transition:color 0.2s ease;font-family:inherit;text-align:left;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.contextual-ai-source-item:hover{color:#2e70ff;text-decoration:underline}.contextual-ai-loading-container{display:flex;flex-direction:row;align-items:center;gap:8px}.contextual-ai-loading-phrase{font-size:12px;color:#6b7280;font-style:italic}.contextual-ai-modal-overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0, 0, 0, 0.7);display:flex;align-items:center;justify-content:center;z-index:10000;animation:fadeIn 0.2s ease}@keyframes fadeIn{from{opacity:0}to{opacity:1}}.contextual-ai-modal{background:white;border-radius:12px;width:90%;max-width:600px;max-height:80vh;display:flex;flex-direction:column;box-shadow:0 20px 60px rgba(0, 0, 0, 0.3);animation:slideUp 0.3s ease}@keyframes slideUp{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.contextual-ai-modal-header{display:flex;align-items:center;justify-content:space-between;padding:24px 24px 0 24px;border-bottom:none}.contextual-ai-modal-header h3{margin:0;font-size:18px;font-weight:600;color:#1f2937;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;margin-right:12px}.contextual-ai-modal-close{background:transparent;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#6b7280;transition:all 0.2s ease;display:flex;align-items:center;justify-content:center;flex-shrink:0}.contextual-ai-modal-close:hover{background:#f3f4f6;color:#374151}.contextual-ai-modal-content{padding:0 24px 24px 24px;overflow-y:auto;flex:1;max-height:60vh}.contextual-ai-modal-loading{text-align:center;color:#6b7280;padding:20px 0}.contextual-ai-preview-header{margin-bottom:16px;padding-bottom:12px;border-bottom:1px solid #e5e7eb}.contextual-ai-preview-header p{margin:4px 0;font-size:14px;color:#374151}.contextual-ai-preview-text{font-size:14px;line-height:1.6;color:#1f2937;background:#f9fafb;padding:16px;border-radius:8px;border:1px solid #e5e7eb;max-height:400px;overflow-y:auto}.contextual-ai-preview-image{background:white;padding:12px;border-radius:8px;border:1px solid #e5e7eb;text-align:center;overflow:auto;max-width:100%;transition:all 0.2s ease}.contextual-ai-preview-image img{max-width:100%;height:auto;border-radius:4px;box-shadow:0 2px 8px rgba(0, 0, 0, 0.1);transition:max-width 0.3s ease-in-out}.contextual-ai-preview-image.zoomed img{max-width:250%}.contextual-ai-modal-note{margin-top:16px;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px;color:#6b7280}.contextual-ai-citation{color:#2e70ff;cursor:pointer;transition:color 0.2s ease;font-size:0.9em;vertical-align:super;text-decoration:none}.contextual-ai-citation:hover{color:#1e5fef;text-decoration:underline}.contextual-ai-url-link{color:#2e70ff;text-decoration:none;transition:color 0.2s ease;word-break:break-all}.contextual-ai-url-link:hover{color:#1e5fef;text-decoration:underline}.contextual-ai-message-error{background:#fee2e2;border-color:#fca5a5;color:#991b1b}.contextual-ai-workflow-section{margin-top:8px;margin-bottom:8px}.contextual-ai-workflow-stage{display:flex;align-items:center;gap:8px;font-size:12px;color:#1e5fef;margin-bottom:8px}.contextual-ai-workflow-toggle{display:inline-flex;align-items:center;gap:8px;background:none;border:none;padding:0;font-size:12px;color:#6b7280;cursor:pointer;transition:color 0.2s ease;font-family:inherit}.contextual-ai-workflow-toggle:hover{color:#111827}.contextual-ai-workflow-status-icon{width:12px;height:12px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-shrink:0}.contextual-ai-workflow-status-icon.running{background:#1e5fef}.contextual-ai-workflow-status-icon.completed{background:#10b981}.contextual-ai-workflow-status-icon svg{width:8px;height:8px;color:white}.contextual-ai-workflow-toggle .spinner{width:8px;height:8px;border:1.5px solid rgba(255, 255, 255, 0.3);border-top-color:white;border-radius:50%;animation:contextual-ai-spin 0.8s linear infinite}.contextual-ai-workflow-summary{margin-left:20px;margin-top:4px;font-size:10px;color:#9ca3af}.contextual-ai-workflow-details{margin-top:8px;display:none;flex-direction:column;gap:4px}.contextual-ai-workflow-details.expanded{display:flex}.contextual-ai-activity-item{display:flex;flex-direction:column;border-left:2px solid #e5e7eb;margin-left:5px;padding-left:12px;padding-bottom:8px}.contextual-ai-activity-header{display:flex;align-items:center;gap:8px;font-size:12px;cursor:pointer}.contextual-ai-activity-icon{color:#9ca3af;display:flex;align-items:center}.contextual-ai-activity-name{flex:1;color:#4b5563}.contextual-ai-activity-item.running .contextual-ai-activity-name{color:#111827;font-weight:500}.contextual-ai-activity-spinner{width:10px;height:10px;border:1.5px solid #e5e7eb;border-top-color:#1e5fef;border-radius:50%;animation:contextual-ai-spin 0.8s linear infinite}.contextual-ai-activity-chevron{width:10px;height:10px;color:#9ca3af;transition:transform 0.2s ease}.contextual-ai-activity-item.expanded .contextual-ai-activity-chevron{transform:rotate(90deg)}.contextual-ai-activity-content{display:none;margin-top:4px;padding:8px;background:#f9fafb;border-radius:4px;font-family:'Monaco', 'Menlo', 'Ubuntu Mono', monospace;font-size:11px;color:#4b5563;white-space:pre-wrap;max-height:150px;overflow-y:auto;overflow-x:hidden;word-break:break-word;border:1px solid #e5e7eb;box-sizing:border-box}.contextual-ai-activity-item.expanded .contextual-ai-activity-content{display:block}@keyframes contextual-ai-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}"}],"page":{"pagePath":"api-reference/agents/create-agent","slug":"/api-reference/agents/create-agent","pageMetadata":{"title":"Create Agent","description":"Create a new `Agent` with a specific configuration.\n\nThis creates a specialized RAG `Agent` which queries over one or multiple `Datastores` to retrieve relevant data on which its generations are grounded.\n\nRetrieval and generation parameters are defined in the provided `Agent` configuration.\n\n> Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: \"This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.\"","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents","href":"/api-reference/agents/create-agent","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {Fragment: _Fragment, jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n blockquote: \"blockquote\",\n code: \"code\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_Fragment, {\n children: [_jsxs(_components.p, {\n children: [\"Create a new \", _jsx(_components.code, {\n children: \"Agent\"\n }), \" with a specific configuration.\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"This creates a specialized RAG \", _jsx(_components.code, {\n children: \"Agent\"\n }), \" which queries over one or multiple \", _jsx(_components.code, {\n children: \"Datastores\"\n }), \" to retrieve relevant data on which its generations are grounded.\"]\n }), \"\\n\", _jsxs(_components.p, {\n children: [\"Retrieval and generation parameters are defined in the provided \", _jsx(_components.code, {\n children: \"Agent\"\n }), \" configuration.\"]\n }), \"\\n\", _jsxs(_components.blockquote, {\n children: [\"\\n\", _jsx(_components.p, {\n children: \"Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: “This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.”\"\n }), \"\\n\"]\n })]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Create Agent","description":"Create a new `Agent` with a specific configuration.\n\nThis creates a specialized RAG `Agent` which queries over one or multiple `Datastores` to retrieve relevant data on which its generations are grounded.\n\nRetrieval and generation parameters are defined in the provided `Agent` configuration.\n\n> Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: \"This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.\"","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents","href":"/api-reference/agents/create-agent","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":["/_mintlify/custom/contextualai/1642d053fb0d02f4/scripts/openapi.js","/_mintlify/custom/contextualai/b4353988837b3a75/scripts/assistant.js"],"openApiReferenceData":{"operation":{"tags":["/agents"],"summary":"Create Agent","description":"Create a new `Agent` with a specific configuration.\n\nThis creates a specialized RAG `Agent` which queries over one or multiple `Datastores` to retrieve relevant data on which its generations are grounded.\n\nRetrieval and generation parameters are defined in the provided `Agent` configuration.\n\n> Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: \"This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.\"","operationId":"create_agent_agents_post","requestBody":"ceb5e49c-4cb0-4cde-a2ec-69bf88e91cbf","responses":{"200":"75c7d8b3-fa52-4fe4-8289-e9023e0a607e","422":"a7676d5f-c452-40f4-ba5c-1145a6c20568"},"method":"post","type":"path","servers":["4f784b82-11e4-4de4-bd1c-959f6a96fca9"],"security":["00949c99-df54-43a8-8f74-943f448c3f3e"],"path":"/agents","baseUrlOptions":["https://api.contextual.ai/v1"],"title":"Create Agent","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"required":true,"content":{"application/json":{"schema":{"properties":{"name":{"type":"string","maxLength":200,"minLength":3,"title":"Name","description":"Name of the agent","isRequired":true,"uniqueKey":"name","typeLabel":"string"},"system_prompt":{"type":"string","maxLength":8000,"title":"System Prompt","description":"Instructions that your agent references when generating responses. Note that we do not guarantee that the system will follow these instructions exactly.","uniqueKey":"system_prompt","typeLabel":"string"},"no_retrieval_system_prompt":{"type":"string","maxLength":8000,"title":"No Retrieval System Prompt","description":"Instructions on how the agent should respond when there are no relevant retrievals that can be used to answer a query.","uniqueKey":"no_retrieval_system_prompt","typeLabel":"string"},"multiturn_system_prompt":{"type":"string","maxLength":8000,"title":"Multiturn System Prompt","description":"Instructions on how the agent should handle multi-turn conversations.","uniqueKey":"multiturn_system_prompt","typeLabel":"string"},"filter_prompt":{"type":"string","maxLength":8000,"title":"Filter Prompt","description":"The prompt to an LLM which determines whether retrieved chunks are relevant to a given query and filters out irrelevant chunks.","uniqueKey":"filter_prompt","typeLabel":"string"},"suggested_queries":{"items":{"type":"string","uniqueKey":"suggested_queries.items.[INDEX]","typeLabel":"string"},"type":"array","title":"Suggested Queries","description":"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.","uniqueKey":"suggested_queries","typeLabel":"string[]"},"agent_configs":{"properties":{"retrieval_config":{"properties":{"top_k_retrieved_chunks":{"type":"integer","title":"Top K Retrieved Chunks","description":"The maximum number of retrieved chunks from the datastore.","ge":1,"le":200,"uniqueKey":"agent_configs.retrieval_config.top_k_retrieved_chunks","typeLabel":"integer"},"lexical_alpha":{"type":"number","title":"Lexical Alpha","description":"The weight of lexical search during retrieval. Must sum to 1 with semantic_alpha.","le":1,"uniqueKey":"agent_configs.retrieval_config.lexical_alpha","typeLabel":"number"},"semantic_alpha":{"type":"number","title":"Semantic Alpha","description":"The weight of semantic search during retrieval. Must sum to 1 with lexical_alpha.","le":1,"uniqueKey":"agent_configs.retrieval_config.semantic_alpha","typeLabel":"number"}},"type":"object","title":"Retrieval Config","description":"Parameters that affect how the agent retrieves from datastore(s)","uniqueKey":"agent_configs.retrieval_config","typeLabel":"Retrieval Config · object"},"filter_and_rerank_config":{"properties":{"top_k_reranked_chunks":{"type":"integer","title":"Top K Reranked Chunks","description":"The number of highest ranked chunks after reranking to be used","uniqueKey":"agent_configs.filter_and_rerank_config.top_k_reranked_chunks","typeLabel":"integer"},"reranker_score_filter_threshold":{"type":"number","maximum":1,"minimum":0,"title":"Reranker Score Filter Threshold","description":"If the reranker relevance score associated with a chunk is below this threshold, then the chunk will be filtered out and not used for generation. Scores are between 0 and 1, with scores closer to 1 being more relevant. Set the value to 0 to disable the reranker score filtering. ","default":0,"uniqueKey":"agent_configs.filter_and_rerank_config.reranker_score_filter_threshold","typeLabel":"number"},"rerank_instructions":{"type":"string","title":"Rerank Instruction","description":"Instructions that the reranker references when ranking retrievals. Note that we do not guarantee that the reranker will follow these instructions exactly. Examples: \"Prioritize internal sales documents over market analysis reports. More recent documents should be weighted higher. Enterprise portal content supersedes distributor communications.\" and \"Emphasize forecasts from top-tier investment banks. Recent analysis should take precedence. Disregard aggregator sites and favor detailed research notes over news summaries.\"","uniqueKey":"agent_configs.filter_and_rerank_config.rerank_instructions","typeLabel":"string"},"default_metadata_filters":{"oneOf":[{"type":"object","title":"BaseMetadataFilter","description":"Defines a custom metadata filter. The expected input is a dict which can have different operators, fields and values. For example:\n\n {\"field\": \"title\", \"operator\": \"startswith\", \"value\": \"hr-\"}\n\nUse **lowercase** for `value` when not using `equals` operator. For document_id and date_created the query is built using direct query without nesting.","required":["field","operator"],"example":{"operator":"AND"},"properties":{"field":{"type":"string","title":"Field","description":"Field name to search for in the metadata","isRequired":true,"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.field","typeLabel":"string"},"operator":{"type":"string","enum":["equals","containsany","exists","startswith","gt","gte","lt","lte","notequals","between","wildcard"],"title":"FilterMetadataOperator","description":"Operator to be used for the filter.","isRequired":true,"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.operator","typeLabel":"enum\u003cstring>"},"value":{"oneOf":[{"type":"string","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.0","typeLabel":"string"},{"type":"integer","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.1","typeLabel":"integer"},{"type":"number","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.2","typeLabel":"number"},{"type":"boolean","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.3","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.4.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.4.items.[INDEX].oneOf.1","typeLabel":"integer"},{"type":"number","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.4.items.[INDEX].oneOf.2","typeLabel":"number"},{"type":"boolean","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.4.items.[INDEX].oneOf.3","typeLabel":"boolean"}],"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.4.items.[INDEX]","typeLabel":"string | integer | number | boolean"},"title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.4","typeLabel":"(string | integer | number | boolean)[]"},{"type":"null","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value.oneOf.5","typeLabel":"null"}],"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0.value","typeLabel":"string | integer | number | boolean | (string | integer | number | boolean)[] | null"}},"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.0","typeLabel":"BaseMetadataFilter · object"},{"type":"object","title":"CompositeMetadataFilter","description":"\"Defines a custom metadata filter as a Composite MetadataFilter. Which can be be a list of filters or nested filters.","required":["filters"],"example":{"filters":[{"field":"field1","operator":"equals","value":"value1"}],"operator":"AND"},"properties":{"filters":{"items":{"oneOf":[{"type":"object","title":"BaseMetadataFilter","description":"Defines a custom metadata filter. The expected input is a dict which can have different operators, fields and values. For example:\n\n {\"field\": \"title\", \"operator\": \"startswith\", \"value\": \"hr-\"}\n\nUse **lowercase** for `value` when not using `equals` operator. For document_id and date_created the query is built using direct query without nesting.","required":["field","operator"],"properties":{"field":{"type":"string","title":"Field","description":"Field name to search for in the metadata","isRequired":true,"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.field","typeLabel":"string"},"operator":{"type":"string","enum":["equals","containsany","exists","startswith","gt","gte","lt","lte","notequals","between","wildcard"],"title":"FilterMetadataOperator","description":"Operator to be used for the filter.","isRequired":true,"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.operator","typeLabel":"enum\u003cstring>"},"value":{"oneOf":[{"type":"string","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.0","typeLabel":"string"},{"type":"integer","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.1","typeLabel":"integer"},{"type":"number","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.2","typeLabel":"number"},{"type":"boolean","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.3","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.1","typeLabel":"integer"},{"type":"number","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.2","typeLabel":"number"},{"type":"boolean","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.3","typeLabel":"boolean"}],"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX]","typeLabel":"string | integer | number | boolean"},"title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.4","typeLabel":"(string | integer | number | boolean)[]"},{"type":"null","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value.oneOf.5","typeLabel":"null"}],"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0.value","typeLabel":"string | integer | number | boolean | (string | integer | number | boolean)[] | null"}},"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX].oneOf.0","typeLabel":"BaseMetadataFilter · object"},{}],"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters.items.[INDEX]","typeLabel":"BaseMetadataFilter · object"},"type":"array","title":"Filters","description":"Filters added to the query for filtering docs ","isRequired":true,"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.filters","typeLabel":"BaseMetadataFilter · object[]"},"operator":{"oneOf":[{"type":"string","title":"CompositeOperator","description":"Composite operator to be used to combine filters","enum":["AND","OR","AND_NOT"],"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.operator.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"null","description":"Composite operator to be used to combine filters","uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.operator.oneOf.1","typeLabel":"null"}],"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1.operator","typeLabel":"enum\u003cstring> | null"}},"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters.oneOf.1","typeLabel":"CompositeMetadataFilter · object"}],"uniqueKey":"agent_configs.filter_and_rerank_config.default_metadata_filters","typeLabel":"BaseMetadataFilter · object | CompositeMetadataFilter · object"},"per_datastore_metadata_filters":{"additionalProperties":{"properties":{"filters":{"items":{"oneOf":[{"type":"object","title":"BaseMetadataFilter","description":"Defines a custom metadata filter. The expected input is a dict which can have different operators, fields and values. For example:\n\n {\"field\": \"title\", \"operator\": \"startswith\", \"value\": \"hr-\"}\n\nUse **lowercase** for `value` when not using `equals` operator. For document_id and date_created the query is built using direct query without nesting.","required":["field","operator"],"properties":{"field":{"type":"string","title":"Field","description":"Field name to search for in the metadata","isRequired":true,"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.field","typeLabel":"string"},"operator":{"type":"string","enum":["equals","containsany","exists","startswith","gt","gte","lt","lte","notequals","between","wildcard"],"title":"FilterMetadataOperator","description":"Operator to be used for the filter.","isRequired":true,"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.operator","typeLabel":"enum\u003cstring>"},"value":{"oneOf":[{"type":"string","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.0","typeLabel":"string"},{"type":"integer","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.1","typeLabel":"integer"},{"type":"number","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.2","typeLabel":"number"},{"type":"boolean","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.3","typeLabel":"boolean"},{"type":"array","items":{"oneOf":[{"type":"string","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.1","typeLabel":"integer"},{"type":"number","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.2","typeLabel":"number"},{"type":"boolean","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX].oneOf.3","typeLabel":"boolean"}],"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.4.items.[INDEX]","typeLabel":"string | integer | number | boolean"},"title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.4","typeLabel":"(string | integer | number | boolean)[]"},{"type":"null","title":"Value","description":"The value to be searched for in the field. In case of exists operator, it is not needed.","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value.oneOf.5","typeLabel":"null"}],"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0.value","typeLabel":"string | integer | number | boolean | (string | integer | number | boolean)[] | null"}},"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX].oneOf.0","typeLabel":"BaseMetadataFilter · object"},{}],"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters.items.[INDEX]","typeLabel":"BaseMetadataFilter · object"},"type":"array","title":"Filters","description":"Filters added to the query for filtering docs ","isRequired":true,"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.filters","typeLabel":"BaseMetadataFilter · object[]"},"operator":{"oneOf":[{"type":"string","title":"CompositeOperator","description":"Composite operator to be used to combine filters","enum":["AND","OR","AND_NOT"],"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.operator.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"null","description":"Composite operator to be used to combine filters","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.operator.oneOf.1","typeLabel":"null"}],"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties.operator","typeLabel":"enum\u003cstring> | null"}},"type":"object","required":["filters"],"title":"CompositeMetadataFilter","description":"\"Defines a custom metadata filter as a Composite MetadataFilter. Which can be be a list of filters or nested filters.","uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters.additionalProperties","typeLabel":"CompositeMetadataFilter · object"},"type":"object","title":"Per Datastore Metadata Filters","description":"Defines an optional custom metadata filter per datastore ID. Each entry in the dictionary should have a datastore UUID as the key, and the value should be a metadata filter definition. The filter will be applied in addition to filter(s) specified in `default_metadata_filters` and in the `documents_filters` field in the `/query` request during retrieval.","examples":[{"d49609d9-61c3-4a67-b3bd-5196b10da560":{"filters":[{"field":"field1","operator":"equals","value":"value1"}],"operator":"AND"}}],"uniqueKey":"agent_configs.filter_and_rerank_config.per_datastore_metadata_filters","typeLabel":"Per Datastore Metadata Filters · object"}},"type":"object","title":"Filter And Rerank Config","description":"Parameters that affect filtering and reranking of retrieved knowledge","uniqueKey":"agent_configs.filter_and_rerank_config","typeLabel":"Filter And Rerank Config · object"},"generate_response_config":{"properties":{"model":{"type":"string","enum":["Contextual GLM","Gemini 2.5 Pro","Gemini 2.5 Flash","Gemini 2.0 Flash","Gemini 2.0 Flash Lite","Gemini 3 Flash","Gemini 3 Pro","Claude Opus 4","Claude Sonnet 4","GPT-5","Default"],"title":"Model","description":"The model to use for response generation.","uniqueKey":"agent_configs.generate_response_config.model","typeLabel":"enum\u003cstring>"},"max_new_tokens":{"type":"integer","title":"Max New Tokens","description":"The maximum number of tokens the model can generate in a response.","uniqueKey":"agent_configs.generate_response_config.max_new_tokens","typeLabel":"integer"},"temperature":{"type":"number","title":"Temperature","description":"The sampling temperature, which affects the randomness in the response.","ge":0,"le":1,"uniqueKey":"agent_configs.generate_response_config.temperature","typeLabel":"number"},"top_p":{"type":"number","title":"Top P","description":"A parameter for nucleus sampling, an alternative to `temperature` which also affects the randomness of the response.","ge":0,"le":1,"uniqueKey":"agent_configs.generate_response_config.top_p","typeLabel":"number"},"frequency_penalty":{"type":"number","title":"Frequency Penalty","description":"This parameter adjusts how the model treats repeated tokens during text generation.","uniqueKey":"agent_configs.generate_response_config.frequency_penalty","typeLabel":"number"},"seed":{"type":"integer","title":"Seed","description":"This parameter controls the randomness of how the model selects the next tokens during text generation.","uniqueKey":"agent_configs.generate_response_config.seed","typeLabel":"integer"},"calculate_groundedness":{"type":"boolean","title":"Calculate Groundedness","description":"This parameter controls generation of groundedness scores.","uniqueKey":"agent_configs.generate_response_config.calculate_groundedness","typeLabel":"boolean"},"avoid_commentary":{"type":"boolean","title":"Avoid Commentary","description":"Flag to indicate whether the model should avoid providing additional commentary in responses. Commentary is conversational in nature and does not contain verifiable claims; therefore, commentary is not strictly grounded in available context. However, commentary may provide useful context which improves the helpfulness of responses.","default":false,"uniqueKey":"agent_configs.generate_response_config.avoid_commentary","typeLabel":"boolean"}},"additionalProperties":false,"type":"object","title":"Generate Response Config","description":"Parameters that affect response generation","uniqueKey":"agent_configs.generate_response_config","typeLabel":"Generate Response Config · object"},"global_config":{"properties":{"enable_rerank":{"type":"boolean","title":"Enable Rerank","description":"Enables reranking of retrieved chunks","uniqueKey":"agent_configs.global_config.enable_rerank","typeLabel":"boolean"},"enable_filter":{"type":"boolean","title":"Enable Filter","description":"Enables filtering of retrieved chunks with a separate LLM","uniqueKey":"agent_configs.global_config.enable_filter","typeLabel":"boolean"},"enable_multi_turn":{"type":"boolean","title":"Enable Multi Turn","description":"Enables multi-turn conversations. This feature is currently experimental and will be improved.","uniqueKey":"agent_configs.global_config.enable_multi_turn","typeLabel":"boolean"},"should_check_retrieval_need":{"type":"boolean","title":"Should Check Retrieval Need","description":"Enables checking if retrieval is needed for the query. This feature is currently experimental and will be improved.","uniqueKey":"agent_configs.global_config.should_check_retrieval_need","typeLabel":"boolean"}},"additionalProperties":false,"type":"object","title":"Global Config","description":"Parameters that affect the agent's overall RAG workflow","uniqueKey":"agent_configs.global_config","typeLabel":"Global Config · object"},"reformulation_config":{"properties":{"enable_query_expansion":{"type":"boolean","title":"Enable Query Expansion","description":"Whether to enable query expansion.","uniqueKey":"agent_configs.reformulation_config.enable_query_expansion","typeLabel":"boolean"},"query_expansion_prompt":{"type":"string","title":"Query Expansion Prompt","description":"The prompt to use for query expansion.","uniqueKey":"agent_configs.reformulation_config.query_expansion_prompt","typeLabel":"string"},"enable_query_decomposition":{"type":"boolean","title":"Enable Query Decomposition","description":"Whether to enable query decomposition.","uniqueKey":"agent_configs.reformulation_config.enable_query_decomposition","typeLabel":"boolean"},"query_decomposition_prompt":{"type":"string","title":"Query Decomposition Prompt","description":"The prompt to use for query decomposition.","uniqueKey":"agent_configs.reformulation_config.query_decomposition_prompt","typeLabel":"string"}},"type":"object","title":"Reformulation Config","description":"Parameters that affect the agent's query reformulation","uniqueKey":"agent_configs.reformulation_config","typeLabel":"Reformulation Config · object"},"acl_config":{"properties":{"acl_active":{"type":"boolean","title":"Acl Active","description":"Deprecated field. To be removed in the future.","uniqueKey":"agent_configs.acl_config.acl_active","typeLabel":"boolean"},"acl_yaml":{"type":"string","title":"Acl Yaml","description":"The YAML file to use for Agent Composer.","uniqueKey":"agent_configs.acl_config.acl_yaml","typeLabel":"string"}},"type":"object","title":"Acl Config","description":"Parameters that affect the agent's Agent Composer workflow","uniqueKey":"agent_configs.acl_config","typeLabel":"Acl Config · object"},"translation_config":{"properties":{"translate_needed":{"type":"boolean","title":"Translate Needed","description":"Whether to enable translation for the agent's responses.","uniqueKey":"agent_configs.translation_config.translate_needed","typeLabel":"boolean"},"translate_confidence":{"type":"number","title":"Translate Confidence","description":"The confidence threshold for translation.","uniqueKey":"agent_configs.translation_config.translate_confidence","typeLabel":"number"}},"type":"object","title":"Translation Config","description":"Parameters that affect the agent's translation workflow","uniqueKey":"agent_configs.translation_config","typeLabel":"Translation Config · object"}},"type":"object","title":"Agent Configs","description":"The following advanced parameters are experimental and subject to change.","uniqueKey":"agent_configs","typeLabel":"Agent Configs · object"},"description":{"type":"string","maxLength":500,"title":"Description","description":"Description of the agent","default":"","uniqueKey":"description","typeLabel":"string"},"template_name":{"oneOf":[{"type":"string","title":"DefaultTemplateName","description":"The template defining the base configuration for the agent. This can be a built-in template (DefaultTemplateName) or a custom template name","default":"default","enum":["default","finance","customer_support","company_policy_q_and_a"],"uniqueKey":"template_name.oneOf.0","typeLabel":"enum\u003cstring>"},{"type":"string","title":"Template Name","description":"The template defining the base configuration for the agent. This can be a built-in template (DefaultTemplateName) or a custom template name","default":"default","uniqueKey":"template_name.oneOf.1","typeLabel":"string"}],"uniqueKey":"template_name","typeLabel":"enum\u003cstring> | string"},"datastore_ids":{"items":{"type":"string","format":"uuid","uniqueKey":"datastore_ids.items.[INDEX]","typeLabel":"string\u003cuuid>"},"type":"array","title":"Datastore Ids","description":"The IDs of the datastore to associate with this agent.","uniqueKey":"datastore_ids","typeLabel":"string\u003cuuid>[]"}},"additionalProperties":false,"type":"object","required":["name"],"title":"CreateAgentRequest","description":"Input to Create Agent request","uniqueKey":"","typeLabel":"CreateAgentRequest · object"},"examples":{"Example":{"title":"Example","value":{"name":"\u003cstring>","system_prompt":"\u003cstring>","no_retrieval_system_prompt":"\u003cstring>","multiturn_system_prompt":"\u003cstring>","filter_prompt":"\u003cstring>","suggested_queries":["\u003cstring>"],"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":"\u003cstring>","default_metadata_filters":{"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":"\u003cstring>","enable_query_decomposition":true,"query_decomposition_prompt":"\u003cstring>"},"acl_config":{"acl_active":true,"acl_yaml":"\u003cstring>"},"translation_config":{"translate_needed":true,"translate_confidence":123}},"description":"","template_name":"default","datastore_ids":["3c90c3cc-0d44-4b50-8888-8dd25736052a"]}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"75c7d8b3-fa52-4fe4-8289-e9023e0a607e":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"id":{"type":"string","format":"uuid","title":"Id","description":"ID of the agent","isRequired":true,"uniqueKey":"id","typeLabel":"string\u003cuuid>"},"datastore_ids":{"items":{"type":"string","format":"uuid","uniqueKey":"datastore_ids.items.[INDEX]","typeLabel":"string\u003cuuid>"},"type":"array","title":"Datastore Ids","description":"IDs of the datastores associated with the agent. If no datastore was provided as part of the request, this is a singleton list containing the ID of the automatically created datastore.","isRequired":true,"uniqueKey":"datastore_ids","typeLabel":"string\u003cuuid>[]"}},"type":"object","required":["id","datastore_ids"],"title":"CreateAgentOutput","description":"Response to POST /agents request","uniqueKey":"","typeLabel":"CreateAgentOutput · object"},"examples":{"Example":{"title":"Example","value":{"id":"3c90c3cc-0d44-4b50-8888-8dd25736052a","datastore_ids":["3c90c3cc-0d44-4b50-8888-8dd25736052a"]}}},"exampleType":"generated"}},"exampleType":"generated"},"a7676d5f-c452-40f4-ba5c-1145a6c20568":{"description":"Validation Error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"loc":{"items":{"oneOf":[{"type":"string","uniqueKey":"detail.items.[INDEX].loc.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"detail.items.[INDEX].loc.items.[INDEX].oneOf.1","typeLabel":"integer"}],"uniqueKey":"detail.items.[INDEX].loc.items.[INDEX]","typeLabel":"string | integer"},"type":"array","title":"Location","isRequired":true,"uniqueKey":"detail.items.[INDEX].loc","typeLabel":"(string | integer)[]"},"msg":{"type":"string","title":"Message","isRequired":true,"uniqueKey":"detail.items.[INDEX].msg","typeLabel":"string"},"type":{"type":"string","title":"Error Type","isRequired":true,"uniqueKey":"detail.items.[INDEX].type","typeLabel":"string"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError","uniqueKey":"detail.items.[INDEX]","typeLabel":"ValidationError · object"},"type":"array","title":"Detail","uniqueKey":"detail","typeLabel":"ValidationError · object[]"}},"type":"object","title":"HTTPValidationError","uniqueKey":"","typeLabel":"HTTPValidationError · object"},"examples":{"Example":{"title":"Example","value":{"detail":[{"loc":["\u003cstring>"],"msg":"\u003cstring>","type":"\u003cstring>"}]}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"00949c99-df54-43a8-8f74-943f448c3f3e":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","scopes":[]}}},"servers":{"4f784b82-11e4-4de4-bd1c-959f6a96fca9":{"url":"https://api.contextual.ai/v1"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"API Key","scopes":[]},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"BearerAuth","name":"Authorization"}],"title":"BearerAuth"}]},"originalFileLocation":"api-reference/openapi.json"},"subdomain":"contextualai","siteName":"Contextual AI Documentation","title":"Create Agent - Contextual AI Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-02-24T23:11:50.772Z","originalFileLocation":"api-reference/agents/create-agent.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"light\";if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Create a new Agent with a specific configuration. This creates a specialized RAG Agent which queries over one or multiple Datastores to retrieve relevant data on which its generations are grounded. Retrieval and generation parameters are defined in the provided Agent configuration. \u0026gt; Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: \u0026quot;This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.\u0026quot;\">\u003cmeta data-mint-head name=\"application-name\" content=\"Contextual AI Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Create Agent - Contextual AI Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Create a new Agent with a specific configuration. This creates a specialized RAG Agent which queries over one or multiple Datastores to retrieve relevant data on which its generations are grounded. Retrieval and generation parameters are defined in the provided Agent configuration. \u0026gt; Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: \u0026quot;This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.\u0026quot;\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Contextual AI Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.contextual.ai/api-reference/agents/create-agent\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://contextualai.mintlify.site/_mintlify/api/og/v2?division=%2Fagents\u0026amp;title=Create+Agent\u0026amp;description=Create+a+new+%60Agent%60+with+a+specific+configuration.%0A%0AThis+creates+a+specialized+RAG+%60Agent%60+which+queries+over+one+or+multiple+%60Datastores%60+to+retrieve+relevant\u0026amp;theme=676818c361169a4000c34ca9\u0026amp;signature=61fe9909fb1eca8b96cf7efd969a545683d9bdb613fe3874ba282550418a36e3\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Create Agent - Contextual AI Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Create a new Agent with a specific configuration. This creates a specialized RAG Agent which queries over one or multiple Datastores to retrieve relevant data on which its generations are grounded. Retrieval and generation parameters are defined in the provided Agent configuration. \u0026gt; Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: \u0026quot;This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.\u0026quot;\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://contextualai.mintlify.site/_mintlify/api/og/v2?division=%2Fagents\u0026amp;title=Create+Agent\u0026amp;description=Create+a+new+%60Agent%60+with+a+specific+configuration.%0A%0AThis+creates+a+specialized+RAG+%60Agent%60+which+queries+over+one+or+multiple+%60Datastores%60+to+retrieve+relevant\u0026amp;theme=676818c361169a4000c34ca9\u0026amp;signature=61fe9909fb1eca8b96cf7efd969a545683d9bdb613fe3874ba282550418a36e3\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/contextualai/JqDcfIh6YPJ9nwCM/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Contextual AI Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#2e70ff\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.contextual.ai/api-reference/agents/create-agent\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/agents/create-agent.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.contextual.ai/#organization\",\"name\":\"Contextual AI Documentation\",\"url\":\"https://docs.contextual.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/contextualai/hbpTLlKqktq8fCLj/logo/light.svg?fit=max\u0026auto=format\u0026n=hbpTLlKqktq8fCLj\u0026q=85\u0026s=049c4ad3c96c7cc618c2d6b183e5a683\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.contextual.ai#website\",\"name\":\"Contextual AI Documentation\",\"url\":\"https://docs.contextual.ai\",\"publisher\":{\"@id\":\"https://docs.contextual.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.contextual.ai/api-reference/agents/create-agent#webpage\",\"url\":\"https://docs.contextual.ai/api-reference/agents/create-agent\",\"name\":\"Create Agent\",\"description\":\"Create a new Agent with a specific configuration. This creates a specialized RAG Agent which queries over one or multiple Datastores to retrieve relevant data on which its generations are grounded. Retrieval and generation parameters are defined in the provided Agent configuration. > Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: \\\"This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.\\\"\",\"dateModified\":\"2026-02-24T23:11:50.772Z\",\"isPartOf\":{\"@id\":\"https://docs.contextual.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.contextual.ai/api-reference/agents/create-agent#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.contextual.ai/api-reference/agents/create-agent#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"/agents\",\"item\":\"https://docs.contextual.ai/api-reference/agents/list-agents\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create Agent\",\"item\":\"https://docs.contextual.ai/api-reference/agents/create-agent\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.contextual.ai/api-reference/agents/create-agent#apireference\",\"headline\":\"Create Agent\",\"name\":\"Create Agent\",\"description\":\"Create a new Agent with a specific configuration. This creates a specialized RAG Agent which queries over one or multiple Datastores to retrieve relevant data on which its generations are grounded. Retrieval and generation parameters are defined in the provided Agent configuration. > Note that self-serve users are currently required to create agents through our UI. Otherwise, they will receive the following message: \\\"This endpoint is disabled as you need to go through checkout. Please use the UI to make this request.\\\"\",\"url\":\"https://docs.contextual.ai/api-reference/agents/create-agent\",\"mainEntityOfPage\":{\"@id\":\"https://docs.contextual.ai/api-reference/agents/create-agent#webpage\"},\"dateModified\":\"2026-02-24T23:11:50.772Z\",\"publisher\":{\"@id\":\"https://docs.contextual.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.contextual.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Contextual AI Documentation\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Contextual AI Documentation\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/agents/create-agent.md","siteName":"Contextual AI Documentation","nav":{"global":null,"tabs":[{"tab":"Home","icon":"home","pages":[{"title":"Home","href":""}]},{"tab":"Guides","icon":"compass","pages":[{"title":"Guides","href":"/quickstarts/getting-started"}]},{"tab":"Reference","icon":"books","pages":[{"title":"Reference","href":"/reference/glossary"}]},{"tab":"Examples","icon":"sign-posts-wrench","pages":[{"title":"Examples","href":"/examples/overview-demos"}]},{"tab":"Integrations","icon":"handshake-angle","pages":[{"title":"Integrations","href":"/integration/overview"}]},{"tab":"Releases","icon":"code-merge","pages":[{"title":"Releases","href":"/release-notes/2026"}]},{"tab":"API","icon":"gear-complex-code","groups":[{"group":"/datastores","pages":[{"title":"List Datastores","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores","href":"/api-reference/datastores/list-datastores"},{"title":"Create Datastore","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /datastores","href":"/api-reference/datastores/create-datastore"},{"title":"Reset Datastore","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /datastores/{datastore_id}/reset","href":"/api-reference/datastores/reset-datastore"},{"title":"Edit Datastore Configuration","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /datastores/{datastore_id}","href":"/api-reference/datastores/edit-datastore-configuration"},{"title":"Delete Datastore","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /datastores/{datastore_id}","href":"/api-reference/datastores/delete-datastore"},{"title":"Get Datastore Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/metadata","href":"/api-reference/datastores/get-datastore-metadata"}]},{"group":"/datastores/{id}/documents","pages":[{"title":"List Documents","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/documents","href":"/api-reference/datastores-documents/list-documents"},{"title":"Ingest Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /datastores/{datastore_id}/documents","href":"/api-reference/datastores-documents/ingest-document"},{"title":"Get Document Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/documents/{document_id}/metadata","href":"/api-reference/datastores-documents/get-document-metadata"},{"title":"Update Document Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /datastores/{datastore_id}/documents/{document_id}/metadata","href":"/api-reference/datastores-documents/update-document-metadata"},{"title":"Delete Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /datastores/{datastore_id}/documents/{document_id}","href":"/api-reference/datastores-documents/delete-document"},{"title":"Get Parse Results","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/documents/{document_id}/parse","href":"/api-reference/datastores-documents/get-parse-results"},{"title":"Edit Chunk Content","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /datastores/{datastore_id}/chunks/{content_id}/content","href":"/api-reference/datastores-documents/edit-chunk-content"}]},{"group":"/agents","pages":[{"title":"List Agents","description":"Retrieve a list of all `Agents`.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents","href":"/api-reference/agents/list-agents"},{"title":"Create Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents","href":"/api-reference/agents/create-agent"},{"title":"Edit Agent","description":"Modify a given `Agent` to utilize the provided configuration.\n\nFields not included in the request body will not be modified.","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /agents/{agent_id}","href":"/api-reference/agents/edit-agent"},{"title":"Delete Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /agents/{agent_id}","href":"/api-reference/agents/delete-agent"},{"title":"Get Agent Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/{agent_id}/metadata","href":"/api-reference/agents/get-agent-metadata"},{"title":"Reset Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /agents/{agent_id}/reset","href":"/api-reference/agents/reset-agent"},{"title":"Save Template","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/template","href":"/api-reference/agents/save-template"},{"title":"List Templates","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/templates","href":"/api-reference/agents/list-templates"},{"title":"List Agent Composer Templates","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/templates/acl","href":"/api-reference/agents/list-agent-composer-templates"},{"title":"Get Template Configuration","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/templates/{template}","href":"/api-reference/agents/get-template-configuration"},{"title":"Copy Agent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/copy","href":"/api-reference/agents/copy-agent"}]},{"group":"/contents","pages":[{"title":"Get Document Contents","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/contents","href":"/api-reference/contents/get-document-contents"},{"title":"Get Content Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /datastores/{datastore_id}/contents/{content_id}/metadata","href":"/api-reference/contents/get-content-metadata"}]},{"group":"/agents/{id}/query","pages":[{"title":"Query","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/query/acl","href":"/api-reference/agents-query/query"},{"title":"Query","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/query","href":"/api-reference/agents-query/query-1"},{"title":"Get Retrieval Info","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/{agent_id}/query/{message_id}/retrieval/info","href":"/api-reference/agents-query/get-retrieval-info"},{"title":"Provide Feedback","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /agents/{agent_id}/feedback","href":"/api-reference/agents-query/provide-feedback"},{"title":"Get Metrics","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /agents/{agent_id}/metrics","href":"/api-reference/agents-query/get-metrics"}]},{"group":"/lmunit","pages":[{"title":"LMUnit","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /lmunit","href":"/api-reference/lmunit/lmunit"}]},{"group":"/users","pages":[{"title":"Get Users","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /users","href":"/api-reference/users/get-users"},{"title":"Update User","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /users","href":"/api-reference/users/update-user"},{"title":"Invite Users","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /users","href":"/api-reference/users/invite-users"},{"title":"Remove User","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /users","href":"/api-reference/users/remove-user"}]},{"group":"/generate","pages":[{"title":"Generate","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /generate","href":"/api-reference/generate/generate"}]},{"group":"/rerank","pages":[{"title":"Rerank","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /rerank","href":"/api-reference/rerank/rerank"}]},{"group":"/parse","pages":[{"title":"Parse File","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /parse","href":"/api-reference/parse/parse-file"},{"title":"Parse Status","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /parse/jobs/{job_id}/status","href":"/api-reference/parse/parse-status"},{"title":"Parse Result","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /parse/jobs/{job_id}/results","href":"/api-reference/parse/parse-result"},{"title":"Parse List Jobs","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /parse/jobs","href":"/api-reference/parse/parse-list-jobs"}]},{"group":"/extract","pages":[{"title":"List Schemas","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/schemas","href":"/api-reference/extract/list-schemas"},{"title":"Create Schema","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /extract/schemas","href":"/api-reference/extract/create-schema"},{"title":"Get Schema","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/schemas/{schema_id}","href":"/api-reference/extract/get-schema"},{"title":"Update Schema","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /extract/schemas/{schema_id}","href":"/api-reference/extract/update-schema"},{"title":"Delete Schema","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /extract/schemas/{schema_id}","href":"/api-reference/extract/delete-schema"},{"title":"List Documents","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/documents","href":"/api-reference/extract/list-documents"},{"title":"Upload Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /extract/documents/upload","href":"/api-reference/extract/upload-document"},{"title":"Get Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/documents/{document_id}","href":"/api-reference/extract/get-document"},{"title":"Delete Document","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json delete /extract/documents/{document_id}","href":"/api-reference/extract/delete-document"},{"title":"List Jobs","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/jobs","href":"/api-reference/extract/list-jobs"},{"title":"Start Extraction Job","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json post /extract/jobs","href":"/api-reference/extract/start-extraction-job"},{"title":"Resume Streaming Extraction","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/jobs/{job_id}/stream","href":"/api-reference/extract/resume-streaming-extraction"},{"title":"Get Job Status","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/jobs/{job_id}","href":"/api-reference/extract/get-job-status"},{"title":"Get Job Results","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /extract/jobs/{job_id}/results","href":"/api-reference/extract/get-job-results"},{"title":"Update Job Results","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /extract/jobs/{job_id}/results","href":"/api-reference/extract/update-job-results"}]},{"group":"/workspaces","pages":[{"title":"Get Consent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /workspaces/consent","href":"/api-reference/workspaces/get-consent"},{"title":"Update Consent","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json put /workspaces/consent","href":"/api-reference/workspaces/update-consent"}]},{"group":"/billing","pages":[{"title":"Get Balance","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/balance","href":"/api-reference/billing/get-balance"},{"title":"Get Top Up History Endpoint","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/balance/top-ups","href":"/api-reference/billing/get-top-up-history-endpoint"},{"title":"Get Monthly Usage Endpoint","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/usages/monthly","href":"/api-reference/billing/get-monthly-usage-endpoint"},{"title":"Get Agent Composer Step Usage","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/usages/acl","href":"/api-reference/billing/get-agent-composer-step-usage"},{"title":"Get Earliest Usage Date Endpoint","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/usages/earliest_date","href":"/api-reference/billing/get-earliest-usage-date-endpoint"},{"title":"Get Billing Mode History","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/billing_mode/history","href":"/api-reference/billing/get-billing-mode-history"},{"title":"Get Billing Metadata","deprecated":null,"version":null,"openapi":"/api-reference/openapi.json get /billing/metadata","href":"/api-reference/billing/get-billing-metadata"}]}]}]},"basePath":"","title":"Create Agent - Contextual AI Documentation","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-CybtLBIt.js","utils-BMLj2fvV.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-B6In562Y.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-Dr8Mfhp9.js","snippetPresets-2rmQvMVl.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-WMqJYdZj.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-CJ-MlPHu.js","shallow-dY3TMRCk.js","getApiPlaygroundDisplay-v-1B2bKm.js","CodeSnippet-BDhiTB7U.js","CodeSnippets-D9hnzQcS.js","Page-C4GwDT3_.js","getPastedJson-Th2V45jI.js","icon-BQXch1W9.js","MethodPill-BCqUneP3.js","DuplicateIcon-Q_-bhurZ.js","createIcon-DUjLHRqp.js","DynamicMarkdown-B-f2cqXQ.js","SectionHeading-Da5NsV4v.js","axios-vUo_bRtp.js","Markdown-D13FWkIM.js","clsx-D3Isdib3.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-C-XZBk9h.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink--qIqmmVG.js"]}