npx skills add ...
npx skills add github/gh-aw --skill gh-agent-session
Use gh agent-session commands to inspect and manage agent sessions.
npx skills add github/gh-aw --skill gh-agent-session
The gh agent-task extension creates GitHub Copilot coding agent sessions from the CLI. A session is a GitHub issue that triggers automated code changes from natural language instructions.
Repository: https://github.com/github/agent-task (internal GitHub extension)
Agent sessions are GitHub issues that:
Install via GitHub CLI:
Note: This extension requires authentication with a Personal Access Token (PAT) that has appropriate permissions for creating issues and pull requests.
Create a new agent session from a description:
Command Parameters:
--from-file <path>: Read task description from file--base <branch>: Base branch for the pull request (default: repository default branch)--repo <owner/repo>: Target repository (default: current repository)Output Format: The command outputs the URL of the created agent session:
List agent sessions in a repository:
View details of a specific agent session:
Update an existing agent session:
Agent session descriptions should be clear, specific natural language instructions:
Good Example:
Poor Example:
Best Practices:
The gh agent-task extension is used by the create-agent-session safe output feature in GitHub Agentic Workflows (gh-aw).
The safe output processor:
create_agent_task items from the structured outputgh agent-task create --from-file <file> --base <branch>Environment Variables:
GITHUB_AW_AGENT_TASK_BASE: Base branch for the pull requestGITHUB_AW_TARGET_REPO: Target repository for cross-repo task creationGITHUB_AW_SAFE_OUTPUTS_STAGED: Preview mode flagAgent session creation requires elevated permissions beyond the default GITHUB_TOKEN:
Required Permissions:
contents: write - To create branches and commitsissues: write - To create the agent session issuepull-requests: write - To create pull requestsToken Precedence:
COPILOT_GITHUB_TOKEN - Dedicated Copilot operations token (recommended)GH_AW_GITHUB_TOKEN - General override token (legacy)github-token configuration fieldNote: The default GITHUB_TOKEN is not supported as it lacks required permissions. The COPILOT_CLI_TOKEN and GH_AW_COPILOT_TOKEN secrets are no longer supported as of v0.26+.
Store your Personal Access Token in repository secrets:
:::note[Backward Compatibility]
Legacy token name GH_AW_GITHUB_TOKEN is still supported for backward compatibility. The GH_AW_COPILOT_TOKEN token is no longer supported as of v0.26+.
:::
Solution: Configure COPILOT_GITHUB_TOKEN or legacy GH_AW_GITHUB_TOKEN with a PAT.
Solution: Ensure the token has contents: write, issues: write, and pull-requests: write permissions.
Solution: Verify the target repository exists and the token has access to it.
When safe-outputs.staged: true, agent sessions are previewed without creation:
Staged Output:
Symptom: No error but no task created
Check:
COPILOT_GITHUB_TOKEN is set in repository secretsSymptom: Task created but no automated PR
Possible Causes:
Solution: Check repository Copilot settings and refine task description.
Symptom: Error when creating tasks in different repository
Check:
When used via safe outputs, the create-agent-session job provides outputs:
Usage in Dependent Jobs: