GitHub Action
Automatically register and update your agent on AgentDNS whenever you push to your main branch. One file in your repo, one secret in GitHub — done.
How it works
1
Add agentdns.json
Create an agentdns.json in your repo root with your agent's details
2
Add secret
Add AGENTDNS_API_KEY to your repository secrets
3
Auto-sync
Every push to main updates your agent in the registry automatically
Setup
Step 1: Create agentdns.json
Add this file to the root of your repository:
{
"slug": "my-agent",
"name": "My Agent",
"tagline": "Does amazing things with AI",
"description": "Full description of what my agent does.",
"capabilities": ["summarization", "translation", "analysis"],
"protocols": ["mcp", "rest"],
"mcp_server_url": "https://my-agent.example.com/mcp",
"api_endpoint": "https://api.my-agent.example.com/v1",
"docs_url": "https://docs.my-agent.example.com",
"pricing_model": "free"
}Step 2: Get an API Key
- Sign in at /dashboard
- Generate an API key with write scope
- In your GitHub repo: Settings → Secrets → Actions → New secret
- Name:
AGENTDNS_API_KEY, Value: your key
Step 3: Add the workflow
Create .github/workflows/agentdns-register.yml:
name: Register on AgentDNS
on:
push:
branches: [main]
paths:
- 'agentdns.json'
- '.github/workflows/agentdns-register.yml'
jobs:
register:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Register / Update Agent on AgentDNS
env:
AGENTDNS_API_KEY: ${{ secrets.AGENTDNS_API_KEY }}
run: |
SLUG=$(jq -r '.slug' agentdns.json)
PAYLOAD=$(cat agentdns.json)
# Try to update first, fall back to create
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-X PATCH "https://agent-dns.tech/api/v1/agents/$SLUG" \
-H "Authorization: Bearer $AGENTDNS_API_KEY" \
-H "Content-Type: application/json" \
-d "$PAYLOAD")
if [ "$STATUS" = "404" ]; then
echo "Agent not found, creating..."
curl -f -X POST "https://agent-dns.tech/api/v1/agents" \
-H "Authorization: Bearer $AGENTDNS_API_KEY" \
-H "Content-Type: application/json" \
-d "$PAYLOAD"
else
echo "Agent updated (HTTP $STATUS)"
fiStep 4: Push to main
Commit and push. The action will run automatically. Check the Actions tab in GitHub to see the result.
Under the Hood
The workflow reads your agentdns.json and calls the AgentDNS REST API:
- First tries
PATCH /api/v1/agents/{slug}to update an existing registration - If the agent doesn't exist (404), falls back to
POST /api/v1/agentsto create it - Uses your
AGENTDNS_API_KEYfor authentication - Runs only when
agentdns.jsonchanges, minimizing unnecessary API calls
Ready to automate?
Generate your API key in the dashboard and add the workflow to your repo.