Loading...
    • 빌드
    • 관리
    • 모델 및 가격
    • 클라이언트 SDK
    • API 참조
    Search...
    ⌘K
    시작하기
    Claude 소개빠른 시작
    Claude로 구축하기
    기능 개요Messages API 사용중지 이유 처리
    모델 기능
    확장 사고적응형 사고노력빠른 모드 (베타: 리서치 프리뷰)구조화된 출력인용스트리밍 메시지일괄 처리검색 결과스트리밍 거부다국어 지원임베딩
    도구
    개요도구 사용 방법웹 검색 도구웹 가져오기 도구코드 실행 도구메모리 도구Bash 도구컴퓨터 사용 도구텍스트 편집기 도구
    도구 인프라
    도구 검색프로그래밍 방식 도구 호출세밀한 도구 스트리밍
    컨텍스트 관리
    컨텍스트 윈도우압축컨텍스트 편집프롬프트 캐싱토큰 계산
    파일 작업
    Files APIPDF 지원이미지 및 비전
    스킬
    개요빠른 시작모범 사례엔터프라이즈용 스킬API의 스킬
    MCP
    원격 MCP 서버MCP 커넥터
    프롬프트 엔지니어링
    개요프롬프트 모범 사례Console 프롬프트 도구
    테스트 및 평가
    성공 기준 정의 및 평가 구축Console의 평가 도구 사용지연 시간 줄이기
    가드레일 강화
    환각 줄이기출력 일관성 높이기탈옥 방지프롬프트 유출 줄이기
    리소스
    용어집
    릴리스 노트
    Claude Platform
    Console
    Log in
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...
    Loading...

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    에이전트에 작업 위임

    파일 추가

    파일을 업로드하고 컨테이너에 마운트하여 읽기 및 처리에 활용하세요.

    Was this page helpful?

    Files API를 통해 파일을 업로드하고 세션의 컨테이너에 마운트하여 에이전트에 파일을 제공할 수 있습니다.

    모든 Managed Agents API 요청에는 managed-agents-2026-04-01 베타 헤더가 필요합니다. SDK는 베타 헤더를 자동으로 설정합니다.

    파일 업로드

    먼저 Files API를 사용하여 파일을 업로드합니다:

    file=$(curl --fail-with-body -sS "${auth[@]}" \
      "${base_url}/files" \
      -F [email protected])
    file_id=$(jq -er '.id' <<<"${file}")
    printf 'File ID: %s\n' "${file_id}"

    세션에 파일 마운트

    세션을 생성할 때 resources 배열에 파일을 추가하여 업로드된 파일을 컨테이너에 마운트합니다:

    mount_path는 선택 사항이지만, 에이전트가 무엇을 찾고 있는지 알 수 있도록 업로드된 파일에 설명적인 이름을 지정하세요.

    세션 내 파일 인스턴스를 참조하는 새로운 file_id가 생성됩니다. 이 복사본은 스토리지 한도에 포함되지 않습니다.

    여러 파일

    resources 배열에 항목을 추가하여 여러 파일을 마운트합니다:

    세션당 최대 100개의 파일이 지원됩니다.

    실행 중인 세션의 파일 관리

    세션 리소스 API를 사용하여 세션 생성 후 파일을 추가하거나 제거할 수 있습니다. 각 리소스는 추가(또는 목록 조회) 시 반환되는 id를 가지며, 이를 삭제 시 사용합니다.

    resources.list로 세션의 모든 리소스를 나열합니다. 파일을 제거하려면 리소스 ID와 함께 resources.delete를 호출합니다:

    세션 파일 목록 조회 및 다운로드

    Files API를 사용하여 세션에 범위가 지정된 파일을 나열하고 다운로드합니다.

    지원되는 파일 형식

    에이전트는 다음을 포함한 모든 파일 형식을 처리할 수 있습니다:

    • 소스 코드 (.py, .js, .ts, .go, .rs 등)
    • 데이터 파일 (.csv, .json, .xml, .yaml)
    • 문서 (.txt, .md)
    • 아카이브 (.zip, .tar.gz) - 에이전트가 bash를 사용하여 압축을 해제할 수 있습니다
    • 바이너리 파일 - 에이전트가 적절한 도구로 처리할 수 있습니다

    파일 경로

    컨테이너에 마운트된 파일은 읽기 전용 복사본입니다. 에이전트는 파일을 읽을 수 있지만 원본 업로드 파일을 수정할 수 없습니다. 수정된 버전으로 작업하려면 에이전트가 컨테이너 내의 새 경로에 씁니다.

    • 파일은 지정한 정확한 경로에 마운트됩니다
    • 상위 디렉토리는 자동으로 생성됩니다
    • 경로는 절대 경로여야 합니다 (/로 시작)
    session=$(
      jq -n \
        --arg agent_id "${agent_id}" \
        --arg environment_id "${environment_id}" \
        --arg file_id "${file_id}" \
        '{
          agent: $agent_id,
          environment_id: $environment_id,
          resources: [
            {
              type: "file",
              file_id: $file_id,
              mount_path: "/workspace/data.csv"
            }
          ]
        }' | curl --fail-with-body -sS "${auth[@]}" "${base_url}/sessions" --json @-
    )
    session_id=$(jq -er '.id' <<<"${session}")
    "resources": [
      { "type": "file", "file_id": "file_abc123", "mount_path": "/workspace/data.csv" },
      { "type": "file", "file_id": "file_def456", "mount_path": "/workspace/config.json" },
      { "type": "file", "file_id": "file_ghi789", "mount_path": "/workspace/src/main.py" }
    ]
    resource=$(
      jq -n --arg file_id "${file_id}" '{type: "file", file_id: $file_id}' \
        | curl --fail-with-body -sS "${auth[@]}" \
            "${base_url}/sessions/${session_id}/resources" --json @-
    )
    resource_id=$(jq -er '.id' <<<"${resource}")
    printf '%s\n' "${resource_id}"  # "sesrsc_01ABC..."
    curl --fail-with-body -sS "${auth[@]}" \
      "${base_url}/sessions/${session_id}/resources" \
      | jq -r '.data[] | "\(.id) \(.type)"'
    
    curl --fail-with-body -sS "${auth[@]}" -X DELETE \
      "${base_url}/sessions/${session_id}/resources/${resource_id}" >/dev/null
    # 세션과 연관된 파일 목록 조회
    curl -fsSL "https://api.anthropic.com/v1/files?scope_id=sess_abc123" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "anthropic-beta: files-api-2025-04-14"
    
    # 파일 다운로드
    curl -fsSL "https://api.anthropic.com/v1/files/$FILE_ID/content" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -H "anthropic-beta: files-api-2025-04-14" \
      -o output.txt