

# CreateAgentContext

Creates an agent context over one or more connections. Creation is asynchronous. GetAgentContext returns its status.

## Request Parameters
<a name="API_CreateAgentContext_RequestParameters"></a>

 ** clientToken **   
Client idempotency token. The AWS SDKs generate one when it is absent. An identical request with the same token returns the existing agent context. The same token with a different request returns ValidationException. `trustedIdentitySources` with the same entries in another order is the same request.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[\x21-\x7E]+`   
Required: No

 ** connectionMappings **   
The connection mappings for this agent context, up to 20. CreateAgentContext requires at least one: an empty list returns `ValidationException`. Each entry binds a connection to one or more ontologies, optionally scoped by a data filter, extraction depth, and path segments. Each referenced connection must exist, be owned by your account, and be `ACTIVE`. Order is significant. When several connections reach the same AWS Glue Data Catalog table, AWS Context tries the connection mapped first, with its own access, and then the next.  
Type: Array of [ConnectionMapping](API_ConnectionMapping.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 20 items.  
Required: Yes

 ** curationPolicyIds **   
Curation policies to associate with the new agent context, as IDs or ARNs, instead of the default curation policies. If you omit it or the list is empty, AWS Context associates the default curation policies. Each policy must be `ACTIVE` and owned by your account, and you need `context:AssociateCurationPolicy` permission on each. AWS Context checks both again on a `clientToken` retry. If a policy doesn't exist, the request fails with `ResourceNotFoundException`. If one has been deleted, it fails with `ConflictException`. Change the policies later with AssociateCurationPolicy and DisassociateCurationPolicy.  
Type: Array of strings  
Array Members: Minimum number of 0 items. Maximum number of 10 items.  
Length Constraints: Minimum length of 1. Maximum length of 180.  
Pattern: `(arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:\d{12}:curation-policy/)?[a-z0-9]+(-[a-z0-9]+)*`   
Required: No

 ** description **   
Optional human-readable description of the agent context. An empty string is the same as none.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.  
Pattern: `\P{Cc}*`   
Required: No

 ** entityResolutionConfig **   
Optional entity resolution settings. When the config or its `status` is absent, `status` reads ENABLED. You can change it with UpdateAgentContext.  
Type: [EntityResolutionConfig](API_EntityResolutionConfig.md) object  
Required: No

 ** name **   
Optional. The name of the agent context. If you omit it, the name is `default`. You can change it later with UpdateAgentContext.  
Type: String  
Length Constraints: Minimum length of 3. Maximum length of 63.  
Pattern: `[a-zA-Z][a-zA-Z0-9-]*`   
Required: No

 ** tags **   
Tags to add to the agent context when you create it: up to 200 in the request, of which at most 50 can be user tags. Keys can't start with `aws:`. To add tags, you also need `context:TagResource` permission on the new agent context. If you specify more than 50 user tags, the request fails with `ServiceQuotaExceededException`, as on TagResource. If an AWS Organizations tag policy refuses a tag, the request fails with `ValidationException`.  
Type: String to string map  
Map Entries: Minimum number of 0 items. Maximum number of 200 items.  
Key Length Constraints: Minimum length of 1. Maximum length of 128.  
Value Length Constraints: Minimum length of 0. Maximum length of 256.  
Required: No

 ** traceAnalysisConfig **   
The agent context's trace analysis settings. Optional. You can change it with UpdateAgentContext.  
Type: [TraceAnalysisConfig](API_TraceAnalysisConfig.md) object  
Required: No

 ** trustedIdentitySources **   
Optional identity sources to trust in addition to your account. At most 100 unique entries, each with exactly one member. Order is not significant. An empty list and an absent member are the same value: only your account is trusted. You can change it with UpdateAgentContext.  
Type: Array of [TrustedIdentitySource](API_TrustedIdentitySource.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 100 items.  
Required: No

 ** workforceSignInConfig **   
Optional workforce sign-in settings. A config with `signInUrl` turns sign-in on (`status` defaults to ENABLED). `status` ENABLED without `signInUrl` is a ValidationException. You can change it with UpdateAgentContext.  
Type: [WorkforceSignInConfig](API_WorkforceSignInConfig.md) object  
Required: No

## Response Elements
<a name="API_CreateAgentContext_ResponseElements"></a>

The following elements are returned by the service.

 ** arn **   
The ARN of the agent context, in the form `arn:<partition>:context:<region>:<account-id>:agent-context/<id>`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 180.  
Pattern: `arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:\d{12}:agent-context/[a-z0-9]+(-[a-z0-9]+)*` 

 ** connectionMappings **   
The agent context's connection mappings.  
Type: Array of [ConnectionMapping](API_ConnectionMapping.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 20 items.

 ** createdAt **   
The date and time when the agent context was created.  
Type: Timestamp

 ** description **   
A human-readable description, if one was set.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.  
Pattern: `\P{Cc}*` 

 ** encryptionConfig **   
The agent context's encryption settings.  
Type: [EncryptionConfig](API_EncryptionConfig.md) object

 ** entityResolutionConfig **   
The agent context's entity resolution settings. Populated on every response path that returns the resource.  
Type: [EntityResolutionConfig](API_EntityResolutionConfig.md) object

 ** id **   
The agent context's opaque ID.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[a-z0-9]+(-[a-z0-9]+)*` 

 ** mcpServerUrl **   
The Model Context Protocol (MCP) server URL to give your employees while workforce sign-in is `ENABLED`. The URL is the agent context's MCP endpoint, with `workforceSignInConfig.signInUrl` as its `login_hint` query parameter and the ID that AWS Context assigns to that sign-in URL as its `tenantId` query parameter. Absent while workforce sign-in is `DISABLED`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 4096.

 ** name **   
The name of the agent context. If you didn't specify a name when you created it, the name is `default`.  
Type: String  
Length Constraints: Minimum length of 3. Maximum length of 63.  
Pattern: `[a-zA-Z][a-zA-Z0-9-]*` 

 ** status **   
The agent context's lifecycle status.  
Valid values:  
+  `CREATING` - The agent context is being created.
+  `ACTIVE` - The agent context is ready to use.
+  `UPDATING` - The agent context is being updated.
+  `DELETING` - The agent context is being deleted.
+  `FAILED` - The agent context failed.
Type: String  
Valid Values: `CREATING | ACTIVE | UPDATING | DELETING | FAILED` 

 ** traceAnalysisConfig **   
The agent context's trace analysis settings.  
Type: [TraceAnalysisConfig](API_TraceAnalysisConfig.md) object

 ** trustedIdentitySources **   
Identity sources this agent context trusts in addition to its owner's account. Absent or empty: only the owner's account is trusted.  
Type: Array of [TrustedIdentitySource](API_TrustedIdentitySource.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 100 items.

 ** updatedAt **   
When the resource last changed. Equal to `createdAt` until the first update.  
Type: Timestamp

 ** workforceSignInConfig **   
How your employees sign in to this agent context's MCP server through your identity provider (workforce sign-in). `status` reads ENABLED while a sign-in URL is stored, DISABLED otherwise.  
Type: [WorkforceSignInConfig](API_WorkforceSignInConfig.md) object

## Errors
<a name="API_CreateAgentContext_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.    
 ** message **   
A message that describes the error.
HTTP Status Code: 403

 ** ConflictException **   
The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.    
 ** message **   
A message that describes the error.  
 ** resourceId **   
The ID of the resource that caused the conflict. When several resources caused it, a comma-separated list of their IDs.  
 ** resourceType **   
The type of the resource that caused the conflict.  
Valid values:  
+  `agent-context` - An agent context.
+  `connection` - A connection.
+  `curation-policy` - A curation policy.
+  `evaluation` - Reserved for future use.
+  `ontology` - An ontology.
+  `ontology-induction` - An ontology induction.
+  `resource-policy` - A resource-based policy.
HTTP Status Code: 409

 ** InternalServerException **   
The request failed because of an internal error. Retry the request.    
 ** message **   
A message that describes the error.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.    
 ** message **   
A message that describes the error.  
 ** resourceId **   
The ID of the resource that was not found.  
 ** resourceType **   
The type of the resource that wasn't found.  
Valid values:  
+  `agent-context` - An agent context.
+  `connection` - A connection.
+  `curation-policy` - A curation policy.
+  `evaluation` - Reserved for future use.
+  `ontology` - An ontology.
+  `ontology-induction` - An ontology induction.
+  `resource-policy` - A resource-based policy.
HTTP Status Code: 404

 ** ServiceQuotaExceededException **   
The request would exceed a service quota. Check the quota that `quotaCode` names, reduce your usage, and then retry the request.    
 ** message **   
A message that describes the error.  
 ** quotaCode **   
The code of the quota that the request would exceed.  
 ** resourceId **   
The ID of the resource that the quota applies to.  
 ** resourceType **   
The type of the resource that the quota applies to.  
Valid values:  
+  `agent-context` - An agent context.
+  `connection` - A connection.
+  `curation-policy` - A curation policy.
+  `evaluation` - Reserved for future use.
+  `ontology` - An ontology.
+  `ontology-induction` - An ontology induction.
+  `resource-policy` - A resource-based policy.  
 ** serviceCode **   
The code of the service that owns the quota.
HTTP Status Code: 402

 ** ThrottlingException **   
The request was denied because it exceeded a request rate quota. Wait, then retry the request.    
 ** message **   
A message that describes the error.  
 ** quotaCode **   
The code of the quota that throttled the request.  
 ** retryAfterSeconds **   
The number of seconds to wait before you retry the request, if AWS Context provides one.  
 ** serviceCode **   
The code of the service whose quota throttled the request.
HTTP Status Code: 429

 ** ValidationException **   
The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.    
 ** fieldList **   
The fields that failed validation, each with a message that describes why.  
 ** message **   
A message that describes the error.  
 ** reason **   
The reason that the input failed validation. Valid values:  
+  `unknownOperation` - The operation isn't recognized.
+  `cannotParse` - The request couldn't be parsed.
+  `fieldValidationFailed` - One or more fields failed validation. `fieldList` describes them.
+  `other` - Another reason. `message` describes it.
HTTP Status Code: 400

## See Also
<a name="API_CreateAgentContext_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/context-2022-07-26/CreateAgentContext) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/context-2022-07-26/CreateAgentContext) 