create_agent
async
¶
create_agent(
agent_name: Name,
*,
config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
client_token: Optional[ClientToken] = None,
instruction: Optional[Instruction] = None,
foundation_model: Optional[ModelIdentifier] = None,
description: Optional[Description] = None,
orchestration_type: Optional[OrchestrationType] = None,
custom_orchestration: Optional[CustomOrchestration] = None,
idle_session_ttl_in_seconds: Optional[SessionTTL] = None,
agent_resource_role_arn: Optional[AgentRoleArn] = None,
customer_encryption_key_arn: Optional[KmsKeyArn] = None,
tags: Optional[TagsMap] = None,
prompt_override_configuration: Optional[PromptOverrideConfiguration] = None,
guardrail_configuration: Optional[GuardrailConfiguration] = None,
memory_configuration: Optional[MemoryConfiguration] = None,
agent_collaboration: Optional[AgentCollaboration] = None,
) -> CreateAgentResponse
Amazon Bedrock Agents (now Amazon Bedrock Agents Classic) is no longer open to new customers. For capabilities similar to Bedrock Agents Classic, explore Amazon Bedrock AgentCore. Existing customers can continue to use the service as normal. For more information, see Amazon Bedrock Agents Classic availability change.
Creates an agent that orchestrates interactions between foundation models, data sources, software applications, user conversations, and APIs to carry out tasks to help customers.
-
Specify the following fields for security purposes.
-
agentResourceRoleArn– The Amazon Resource Name (ARN) of the role with permissions to invoke API operations on an agent. -
(Optional)
customerEncryptionKeyArn– The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent. -
(Optional)
idleSessionTTLinSeconds– Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequentInvokeAgentrequest begins a new session.
-
-
To enable your agent to retain conversational context across multiple sessions, include a
memoryConfigurationobject. For more information, see Configure memory. -
To override the default prompt behavior for agent orchestration and to use advanced prompts, include a
promptOverrideConfigurationobject. For more information, see Advanced prompts. -
If your agent fails to be created, the response returns a list of
failureReasonsalongside a list ofrecommendedActionsfor you to troubleshoot. -
The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.
Parameters:
-
agent_name(Name) –A name for the agent that you create.
-
client_token(Optional[ClientToken], default:None) –A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.
-
instruction(Optional[Instruction], default:None) –Instructions that tell the agent what it should do and how it should interact with users.
-
foundation_model(Optional[ModelIdentifier], default:None) –The identifier for the model that you want to be used for orchestration by the agent you create.
The
modelIdto provide depends on the type of model or throughput that you use:-
If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see Amazon Bedrock base model IDs (on-demand throughput) in the Amazon Bedrock User Guide.
-
If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see Supported Regions and models for cross-region inference in the Amazon Bedrock User Guide.
-
If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see Run inference using a Provisioned Throughput in the Amazon Bedrock User Guide.
-
If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see Use a custom model in Amazon Bedrock in the Amazon Bedrock User Guide.
-
If you use an imported model, specify the ARN of the imported model. You can get the model ARN from a successful call to CreateModelImportJob or from the Imported models page in the Amazon Bedrock console.
-
-
description(Optional[Description], default:None) –A description of the agent.
-
orchestration_type(Optional[OrchestrationType], default:None) –Specifies the type of orchestration strategy for the agent. This is set to
DEFAULTorchestration type, by default. -
custom_orchestration(Optional[CustomOrchestration], default:None) –Contains details of the custom orchestration configured for the agent.
-
idle_session_ttl_in_seconds(Optional[SessionTTL], default:None) –The number of seconds for which Amazon Bedrock keeps information about a user's conversation with the agent.
A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Bedrock deletes any data provided before the timeout.
-
agent_resource_role_arn(Optional[AgentRoleArn], default:None) –The Amazon Resource Name (ARN) of the IAM role with permissions to invoke API operations on the agent.
-
customer_encryption_key_arn(Optional[KmsKeyArn], default:None) –The Amazon Resource Name (ARN) of the KMS key with which to encrypt the agent.
-
tags(Optional[TagsMap], default:None) –Any tags that you want to attach to the agent.
-
prompt_override_configuration(Optional[PromptOverrideConfiguration], default:None) –Contains configurations to override prompts in different parts of an agent sequence. For more information, see Advanced prompts.
-
guardrail_configuration(Optional[GuardrailConfiguration], default:None) –The unique Guardrail configuration assigned to the agent when it is created.
-
memory_configuration(Optional[MemoryConfiguration], default:None) –Contains the details of the memory configured for the agent.
-
agent_collaboration(Optional[AgentCollaboration], default:None) –The agent's collaboration role.
Raises:
-
AccessDeniedException–The request is denied because of missing access permissions.
-
ConflictException–There was a conflict performing an operation.
-
InternalServerException–An internal server error occurred. Retry your request.
-
ServiceQuotaExceededException–The number of requests exceeds the service quota. Resubmit your request later.
-
ThrottlingException–The number of requests exceeds the limit. Resubmit your request later.
-
ValidationException–Input validation failed. Check your request parameters and retry the request.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_bedrock_agent/_services/async_bedrock_agent.py
1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 | |