참고
에이전트 작업 API는 공개 미리 보기 상태에 있으며 변경될 수 있습니다.
에이전트 작업 API를 사용하여 고유한 도구 및 워크플로에 통합 클라우드 에이전트 할 수 있습니다. 예를 들어 새 작업을 시작하거나, 기존 작업을 나열하거나, 작업의 상태를 확인할 수 있습니다.
전체 API 참조는 에이전트 작업에 대한 REST API 엔드포인트을 참조하세요.
인증
에이전트 작업 API는 사용자-서버 토큰만 지원합니다. personal access token를 사용하거나, OAuth app 토큰 또는 GitHub App 사용자-서버 토큰을 사용하여 인증할 수 있습니다.
설치 액세스 토큰과 같은 GitHub App 서버-서버 토큰은 지원되지 않습니다.
API를 통해 작업 시작
새로운 클라우드 에이전트 작업을 시작하려면 /agents/repos/{owner}/{repo}/tasks에 POST 요청을 보냅니다. 유일한 필수 매개 변수는 prompt에이전트에 대한 프롬프트인 매개 변수입니다.
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer YOUR-TOKEN" \
https://api.github.com/agents/repos/OWNER/REPO/tasks \
-d '{
"prompt": "Fix the login button on the homepage",
"base_ref": "main"
}'
curl -X POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer YOUR-TOKEN" \
https://api.github.com/agents/repos/OWNER/REPO/tasks \
-d '{
"prompt": "Fix the login button on the homepage",
"base_ref": "main"
}'
다음 자리 표시자 값을 바꿉다.
YOUR-TOKEN: personal access token 또는 GitHub App 사용자-서버 토큰입니다.OWNER: 리포지토리의 계정 소유자입니다.REPO: 리포지토리의 이름입니다.
요청 본문에 다음 선택적 매개 변수를 포함할 수도 있습니다.
base_ref: 새 브랜치 및 풀 리퀘스트에 대한 기본 브랜치입니다.model: 작업에 사용할 AI 모델입니다. 생략하면 자동 모델 선택 사용됩니다. 지원되는 모델에 대한 자세한 내용은 에이전트 작업에 대한 REST API 엔드포인트을 참조하세요.create_pull_request: 작업에 대한 끌어오기 요청을 생성할지 여부를 결정하는 불리언입니다.
작업 목록
특정 리포지토리 또는 액세스 권한이 있는 모든 리포지토리에 대한 작업을 나열할 수 있습니다.
특정 리포지토리에 대한 작업을 나열하려면 다음을 수행합니다.
curl -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ -H "Authorization: Bearer YOUR-TOKEN" \ https://api.github.com/agents/repos/OWNER/REPO/tasks
curl -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer YOUR-TOKEN" \
https://api.github.com/agents/repos/OWNER/REPO/tasks
모든 리포지토리에서 작업을 나열하려면 다음을 수행합니다.
curl -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ -H "Authorization: Bearer YOUR-TOKEN" \ https://api.github.com/agents/tasks
curl -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer YOUR-TOKEN" \
https://api.github.com/agents/tasks
작업의 상태 확인
특정 작업의 상태를 확인하려면 작업 ID를 사용하여 GET 요청을 보냅니다.
curl -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ -H "Authorization: Bearer YOUR-TOKEN" \ https://api.github.com/agents/repos/OWNER/REPO/tasks/TASK-ID
curl -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer YOUR-TOKEN" \
https://api.github.com/agents/repos/OWNER/REPO/tasks/TASK-ID
확인하려는 작업의 ID로 바꿉 TASK-ID 니다. 작업을 만들거나 작업을 나열할 때 응답에서 이 ID를 가져올 수 있습니다. 응답에는 작업의 현재 state항목이 포함되며, queued``in_progress``completed``failed``idle``waiting_for_user``timed_out다음 중 cancelled하나일 수 있습니다.