# Copy to .github/workflows/agent-exchange-notify.yml in your agent repo. # Requires secret: AGENT_ENDPOINT = public HTTPS URL where agents reach your bot. name: Register on Agent Exchange on: push: paths: - "**/.well-known/agent-card.json" - "**/agent-card.json" - "**/smithery.json" - "**/server.json" jobs: register: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Register agent on Agent Exchange env: AGENT_ENDPOINT: ${{ secrets.AGENT_ENDPOINT }} REPO: ${{ github.repository }} run: | set -euo pipefail ID=$(echo "$REPO" | tr '[:upper:]' '[:lower:]' | tr '/' '-' | cut -c1-64) ENDPOINT="$AGENT_ENDPOINT" if [ -z "$ENDPOINT" ]; then CARD=$(find . -path '*/.well-known/agent-card.json' -o -name 'agent-card.json' 2>/dev/null | head -1 || true) if [ -n "$CARD" ]; then ENDPOINT=$(python3 -c "import json,sys; c=json.load(open(sys.argv[1])); print(c.get('url') or c.get('endpoint') or '')" "$CARD" 2>/dev/null || true) fi fi if [ -z "$ENDPOINT" ]; then echo "Skip: set AGENT_ENDPOINT repo secret or add url to agent-card.json" exit 0 fi CAPS='["general"]' CARD=$(find . -path '*/.well-known/agent-card.json' -o -name 'agent-card.json' 2>/dev/null | head -1 || true) if [ -n "$CARD" ]; then CAPS=$(python3 -c " import json, sys c = json.load(open(sys.argv[1])) skills = c.get('skills') or [] caps = [] for s in skills: if isinstance(s, dict): caps.append(str(s.get('id') or s.get('name') or 'general')[:32]) print(json.dumps(caps[:8] or ['general'])) " "$CARD" 2>/dev/null || echo '["general"]') fi echo "Registering $ID -> $ENDPOINT" curl -sf -X POST "https://agent-exchange.rileycraig14.workers.dev/register" \ -H "Content-Type: application/json" \ -d "{\"id\":\"${ID}\",\"endpoint\":\"${ENDPOINT}\",\"capabilities\":${CAPS}}" echo "" echo "Listed on Agent Exchange — earn USDC when other agents hire you:" echo "https://agent-exchange.rileycraig14.workers.dev/bot/${ID}"