View a markdown version of this page

시작하기 - Amazon Bedrock AgentCore

시작하기

이 주제에서는 데이터 세트를 생성, 채우기 및 게시하기 위한 end-to-end 워크플로를 제공합니다.

데이터 세트 스키마

각 데이터 세트는 생성 schemaType 시를 선언합니다. AgentCore는 선언된 스키마를 수락하기 전에 모든 예제를 검증합니다. 두 가지 스키마 유형이 지원됩니다.

  • AGENTCORE_evaLUATION_PREDEFINED_V1 - 미리 작성된 대화 턴에 대해 에이전트를 테스트하는 데 사용됩니다. 필수 필드: scenario_id, turns (비어 있지 않은 목록, 각 턴에는가 포함되어야 함input).

  • AGENTCORE_valLUATION_SIMULATED_V1 - 합성 대화 생성용입니다. 필수 필드: scenario_id, actor_profile (필수 context 및가 있는 객체goal), input.

전체 스키마 필드 정의, 예제 및 실측 매핑은 데이터 세트 스키마를 참조하세요.

종단 간 워크플로

다음 예제에서는 전체 데이터 세트 수명 주기를 보여줍니다. 생성, 예제 추가, 예제 나열, 버전 게시 및 정리.

AgentCore CLI
  1. # 1. Create dataset agentcore add dataset --name my_eval_dataset \ --schema-type AGENTCORE_EVALUATION_PREDEFINED_V1 # 2. Add your scenarios to the JSONL file # File: agentcore/datasets/my_eval_dataset.jsonl # 3. Deploy to create the dataset and sync examples agentcore deploy # 4. Publish version 1 agentcore dataset publish-version --name my_eval_dataset # 5. Check status (shows versions and example count) agentcore status --type dataset # 6. Download a published version to local file agentcore dataset download --name my_eval_dataset --version 1 # 7. Cleanup agentcore remove dataset --name my_eval_dataset agentcore deploy
AgentCore SDK
  1. from bedrock_agentcore.evaluation import DatasetClient client = DatasetClient(region_name="us-west-2") # 1. Create dataset (polls until ACTIVE) ds = client.create_dataset_and_wait( datasetName="my_eval_dataset", schemaType="AGENTCORE_EVALUATION_PREDEFINED_V1", source={ "inlineExamples": { "examples": [ { "scenario_id": "TC-01", "turns": [{"input": "What is my balance?", "expected_response": "Your balance is $50."}], "assertions": ["Response includes a dollar amount"], } ] } }, ) dataset_id = ds["datasetId"] print(f"Created: {dataset_id}, status={ds['status']}") # 2. Add more examples ds = client.add_examples_and_wait( datasetId=dataset_id, source={ "inlineExamples": { "examples": [ {"scenario_id": "TC-02", "turns": [{"input": "Transfer $100", "expected_response": "Transfer complete."}]} ] } }, ) print(f"Example count: {ds['exampleCount']}") # 3. List examples resp = client.list_dataset_examples(datasetId=dataset_id) for example in resp["examples"]: print(f" {example['exampleId']}: {example['scenario_id']}") # 4. Publish version 1 ds = client.create_dataset_version_and_wait(datasetId=dataset_id) print(f"Published, draftStatus: {ds.get('draftStatus')}") # 5. List versions resp = client.list_dataset_versions(datasetId=dataset_id) for v in resp["versions"]: print(f" Version {v['datasetVersion']}: {v['exampleCount']} examples") # 6. Cleanup client.delete_dataset_and_wait(datasetId=dataset_id)