SDK 통합을 사용하여 AWS Strands Agent를 AgentCore Runtime에 통합하는 가이드

발행: (2025년 12월 26일 오후 04:38 GMT+9)
2 min read
원문: Dev.to

Source: Dev.to

사전 요구 사항

AgentCore에는 두 가지 배포 접근 방식이 있습니다:

  • SDK 통합 – 자동 HTTP 설정 및 내장 배포 옵션 제공.
  • 맞춤형 – 수동 구성.

SDK 통합

SDK를 사용하여 AWS Strands Agent를 AgentCore 런타임에 통합합니다.

설치

pip install bedrock-agentcore

에이전트 생성

from bedrock_agentcore.runtime import BedrockAgentCoreApp
from strands import Agent

app = BedrockAgentCoreApp()
agent = Agent()

@app.entrypoint
def invoke(payload):
    """Process user input and return a response."""
    user_message = payload.get("prompt", "Hello")
    result = agent(user_message)
    return {"result": result.message}

if __name__ == "__main__":
    app.run()

에이전트 테스트

스크립트를 로컬에서 실행합니다:

python my_agent.py

curl을 사용해 엔드포인트를 테스트합니다:

curl -X POST http://localhost:8080/invocations \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Hello world!"}'

배포 방법 선택

StarterToolkit 사용 (방법 1 – 빠른 프로토타이핑)

디렉터리 구조:

your_project_directory/
│   __init__.py      # Makes the directory a Python package
│   requirements.txt

Note: agentcore launch --local 명령은 로컬 테스트를 위해 컨테이너 엔진(Docker, Finch, 또는 Podman)이 필요합니다. 이 단계는 선택 사항이며, 로컬 테스트가 필요하지 않은 경우 바로 agentcore launch를 사용해 AWS에 배포할 수 있습니다.

Boto3 사용 (방법 2 – 수동 배포)

배포 과정을 더 세밀하게 제어하려면:

  1. 코드를 컨테이너 이미지로 패키징합니다.
  2. 이미지를 Amazon Elastic Container Registry (ECR)에 푸시합니다.
  3. Boto3 스크립트 또는 AWS SDK 호출을 사용해 배포합니다.
Back to Blog

관련 글

더 보기 »

주피터 노트북

!Jupyter Notebook의 표지 이미지https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.am...

바이너리

2 GiB “Relocation Barrier” – 왜 대형 바이너리가 x86‑64에서 깨지는가 제가 박사 과정을 진행하고 학술 논문을 제출하면서 겪은 문제는 제가 …