View a markdown version of this page

API 키 가져오기 - Amazon Bedrock AgentCore

API 키 가져오기

API 키를 AgentCore 자격 증명 볼트에 저장한 후에는 AgentCore SDK와 @requires_api_key 주석을 사용하여 에이전트에서 직접 검색할 수 있습니다. 예를 들어 아래 코드는 need_api_key 함수에서 사용할 수 있도록 “your-service-name” API 키 공급자에서 API 키를 검색합니다.

import asyncio from bedrock_agentcore.identity.auth import requires_api_key @requires_api_key( provider_name= "your-service-name" # replace with your own credential provider name ) async def need_api_key(*, api_key: str): # Use the API key pass # To invoke: # asyncio.run(need_api_key())