Claude Platform Docs
  • Messages
  • Managed Agents
  • 관리자

Search...
⌘K
첫 단계
개요빠른 시작Console에서 프로토타입 제작
에이전트 정의
에이전트 설정도구MCP 커넥터권한 정책Agent Skills
에이전트 환경 구성
클라우드 환경 설정클라우드 샌드박스 레퍼런스
에이전트에 작업 위임
세션 시작세션 작업세션 이벤트 스트림웹훅 구독결과 정의볼트로 인증
에이전트 컨텍스트 관리
GitHub 액세스파일 첨부 및 다운로드
고급 오케스트레이션
멀티 에이전트 세션예약 배포
레퍼런스
Managed Agents 레퍼런스
파일 작업
Files APIPDF 지원
스킬
개요모범 사례엔터프라이즈용 스킬
MCP
원격 MCP 서버
클라우드 플랫폼의 Claude
AWS의 Claude Platform

Log in
GitHub 액세스
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Claude Platform Docs

Solutions

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

Partners

  • Claude on AWS
  • Claude on Google Cloud

Learn

  • Blog
  • 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
  • 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
Managed Agents/에이전트 컨텍스트 관리

GitHub 액세스

리포지토리 클론, 읽기 및 풀 리퀘스트 생성을 위해 에이전트를 GitHub 리포지토리에 연결합니다.

GitHub 리포지토리를 세션 샌드박스에 마운트하고 풀 리퀘스트를 생성하기 위해 GitHub MCP에 연결할 수 있습니다.

GitHub 리포지토리는 캐시되므로 동일한 리포지토리를 사용하는 이후 세션은 더 빠르게 시작됩니다.



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

GitHub MCP 및 세션 리소스

먼저 GitHub MCP 서버를 선언하는 에이전트를 생성하세요. 에이전트 정의에는 서버 URL이 포함되지만 인증 토큰은 포함되지 않습니다:

AGENT_ID=$(ant beta:agents create \
  --name "Code Reviewer" \
  --model '{id: claude-opus-4-8}' \
  --system "You are a code review assistant with access to GitHub." \
  --mcp-server '{type: url, name: github, url: https://api.githubcopilot.com/mcp/}' \
  --tool '{type: agent_toolset_20260401}' \
  --tool '{type: mcp_toolset, mcp_server_name: github}' \
  --transform id --raw-output)

그런 다음 GitHub 리포지토리를 마운트하는 세션을 생성하세요:

session = client.beta.sessions.create(
    agent=agent.id,
    environment_id=environment.id,
    resources=[
        {
            "type": "github_repository",
            "url": "https://github.com/org/repo",
            "mount_path": "/workspace/repo",
            "authorization_token": "ghp_your_github_token",
        },
    ],
)

resources[].authorization_token은 리포지토리 클론 작업을 인증하며 API 응답에 다시 표시되지 않습니다.

토큰 권한

GitHub 토큰을 제공할 때는 필요한 최소 권한을 사용하세요:

작업필요한 스코프
비공개 리포지토리 클론repo
PR 생성repo
이슈 읽기repo (비공개) 또는 public_repo
이슈 생성repo (비공개) 또는 public_repo


필요한 최소 권한만 가진 세분화된 개인 액세스 토큰(fine-grained personal access token)을 사용하세요. GitHub 계정에 광범위한 액세스 권한을 가진 토큰은 사용하지 마세요.

여러 리포지토리

resources 배열에 항목을 추가하여 여러 리포지토리를 마운트하세요:

resources = [
    {
        "type": "github_repository",
        "url": "https://github.com/org/frontend",
        "mount_path": "/workspace/frontend",
        "authorization_token": "ghp_your_github_token",
    },
    {
        "type": "github_repository",
        "url": "https://github.com/org/backend",
        "mount_path": "/workspace/backend",
        "authorization_token": "ghp_your_github_token",
    },
]

실행 중인 세션에서 리포지토리 관리

세션이 생성된 후에는 해당 세션의 리포지토리 리소스를 나열하고 인증 토큰을 교체할 수 있습니다. 각 리소스에는 세션 생성 시(또는 resources.list를 통해) 반환되는 id가 있으며, 이를 업데이트에 사용합니다. 리포지토리는 세션의 수명 동안 연결되어 있으므로, 마운트된 리포지토리를 변경하려면 새 세션을 생성하세요.

# 세션의 리소스 나열
listed = client.beta.sessions.resources.list(session.id)
repo_resource_id = listed.data[0].id
print(repo_resource_id)  # "sesrsc_01ABC..."

# 인증 토큰 교체
client.beta.sessions.resources.update(
    repo_resource_id,
    session_id=session.id,
    authorization_token="ghp_your_new_github_token",
)

풀 리퀘스트 생성

GitHub MCP 서버를 사용하면 에이전트가 브랜치를 생성하고, 변경 사항을 커밋하고, 푸시할 수 있습니다:

client.beta.sessions.events.send(
    session.id,
    events=[
        {
            "type": "user.message",
            "content": [
                {
                    "type": "text",
                    "text": "Fix the type error in src/utils.ts, commit it to a new branch, and push it.",
                },
            ],
        },
    ],
)

다음 단계


세션 이벤트 스트림

에이전트가 풀 리퀘스트를 여는 동안 이벤트를 스트리밍하고 에이전트를 조정하세요


MCP 커넥터

더 많은 MCP 서버를 연결하여 에이전트에 추가 도구를 제공하세요


파일 추가

리포지토리와 함께 샌드박스에 파일을 마운트하세요

Was this page helpful?

  • GitHub MCP 및 세션 리소스
  • 토큰 권한
  • 여러 리포지토리
  • 실행 중인 세션에서 리포지토리 관리
  • 풀 리퀘스트 생성
  • 다음 단계