This guide explains how to configure GitHub Agentic Workflows to use custom API endpoints for GitHub Enterprise Cloud (GHEC), GitHub Enterprise Server (GHES), or custom AI endpoints.
GitHub Agentic Workflows supports custom API endpoints through the engine.api-target configuration field. This allows you to specify custom endpoints for:
- GitHub Enterprise Cloud (GHEC) - Tenant-specific Copilot API endpoints
- GitHub Enterprise Server (GHES) - Enterprise Copilot API endpoints
- Custom AI Endpoints - Custom OpenAI-compatible or Anthropic-compatible endpoints
To configure a custom API endpoint, add the api-target field to your engine configuration:
Basic Configuration:
---
engine:
id: copilot
api-target: api.acme.ghe.com
network:
allowed:
- defaults
- acme.ghe.com
- api.acme.ghe.com
---The api-target field accepts a hostname (without protocol or path) and works with any agentic engine.
For GHEC tenants (domains ending with .ghe.com), specify your tenant-specific API endpoint:
Workflow Configuration:
---
engine:
id: copilot
api-target: api.acme.ghe.com
network:
allowed:
- defaults
- acme.ghe.com
- api.acme.ghe.com
---Required domains in network allowlist:
acme.ghe.com- Your GHEC tenant domain (git operations, web UI)api.acme.ghe.com- Your tenant-specific Copilot API endpointraw.githubusercontent.com- Raw content access (if using GitHub MCP server)
For GHES instances (custom domains), specify the enterprise Copilot endpoint:
Workflow Configuration:
---
engine:
id: copilot
api-target: api.enterprise.githubcopilot.com
network:
allowed:
- defaults
- github.company.com
- api.enterprise.githubcopilot.com
---Required domains in network allowlist:
github.company.com- Your GHES instance (git operations, web UI)api.enterprise.githubcopilot.com- Enterprise Copilot API endpoint (used for all GHES instances)
The api-target field works with any agentic engine, allowing you to use custom AI endpoints:
Workflow Configuration:
---
engine:
id: codex
api-target: api.custom.ai-provider.com
network:
allowed:
- defaults
- api.custom.ai-provider.com
------
description: Workflow for GHEC environment with GitHub API access
on:
workflow_dispatch:
permissions:
contents: read
engine:
id: copilot
api-target: api.acme.ghe.com
tools:
github:
mode: remote
toolsets: [default]
network:
allowed:
- defaults
- acme.ghe.com
- api.acme.ghe.com
- raw.githubusercontent.com
---
# Your workflow prompt here---
description: Workflow for GHES environment
on:
issue_comment:
types: [created]
permissions:
contents: read
engine:
id: copilot
api-target: api.enterprise.githubcopilot.com
network:
allowed:
- defaults
- github.company.com
- api.enterprise.githubcopilot.com
---
# Your workflow prompt here---
description: Workflow with custom AI endpoint
on:
workflow_dispatch:
permissions:
contents: read
engine:
id: codex
api-target: api.custom.ai-provider.com
network:
allowed:
- defaults
- api.custom.ai-provider.com
---
# Your workflow prompt hereTo verify your configuration is working correctly:
After compiling your workflow, check the generated .lock.yml file:
gh aw compile your-workflow.mdLook for:
--copilot-api-targetflag in AWF command (if using Copilot engine)- Correct API endpoint hostname in the flag value
In GitHub Actions workflow runs:
- Go to the agent job
- Check the "Run Copilot Agent" (or equivalent) step
- Verify the AWF command includes the correct API target
- Check AWF logs for API connection messages
Problem: Traffic is going to the wrong API endpoint
Solutions:
- Verify
engine.api-targetis set correctly in your workflow frontmatter - Check that the domain is in your
network.allowedlist - Review AWF logs in the workflow run for endpoint configuration messages
- Ensure you're not using a full URL (use hostname only:
api.acme.ghe.comnothttps://api.acme.ghe.com)
Problem: Requests are blocked with network errors
Solution: Add the missing domain to your network.allowed list:
- For GHEC:
[acme.ghe.com, api.acme.ghe.com] - For GHES:
[github.company.com, api.enterprise.githubcopilot.com] - For custom AI:
[api.custom.ai-provider.com]
Problem: GitHub MCP server fails to connect to your enterprise instance
Solutions:
- Ensure your GHEC/GHES domain is in
network.allowed - Verify the GitHub token has appropriate scopes for your enterprise tenant
- Use
mode: remotefor the GitHub MCP server when on GHEC/GHES
- AWF Firewall Configuration - Detailed AWF documentation
- GitHub Actions Environment Variables - Default GitHub Actions variables
- Network Permissions - Network access configuration
- Tools Configuration - MCP server and tool setup