GitHub
Trigger AgentField reasoners from signed GitHub webhooks.
The github source verifies GitHub's X-Hub-Signature-256 header with your webhook secret and dispatches the delivery to a reasoner.
Source Surface
| Surface | Value |
|---|---|
| Source name | github |
| Kind | HTTP webhook |
| Secret | Required; GitHub webhook secret from secret_env |
| Config | No per-source config |
| Event type | X-GitHub-Event, plus .action when the payload has an action field |
| Idempotency | X-GitHub-Delivery |
| Reasoner input | The GitHub JSON payload as event, with trigger metadata in _meta |
GitHub does not ship a separate capability node in OSS. The integration surface is the signed webhook source.
Agent Code
from agentfield import Agent, on_event
app = Agent(node_id="repo-agent")
@app.reasoner()
@on_event(
source="github",
types=["pull_request.opened", "pull_request.synchronize", "issues.opened"],
secret_env="GITHUB_WEBHOOK_SECRET",
)
async def handle_github(event: dict, trigger=None):
return {
"event_type": trigger.event_type if trigger else None,
"delivery": trigger.idempotency_key if trigger else None,
"action": event.get("action"),
}
app.run()GitHub Setup
In the repository or organization settings, create a webhook that points at the AgentField trigger URL. Use application/json, set a webhook secret that matches GITHUB_WEBHOOK_SECRET, and choose the event families your reasoner handles.
Common event families:
pull_requestpushissuesissue_commentworkflow_run
When the payload includes an action, AgentField combines it with the GitHub event name. A pull_request webhook with {"action": "opened"} becomes pull_request.opened.
Dispatch Contract
At dispatch time, the target reasoner receives the normalized payload and metadata:
{
"event": {
"action": "opened",
"pull_request": { "number": 42 },
"repository": { "full_name": "Agent-Field/agentfield" }
},
"_meta": {
"source": "github",
"event_type": "pull_request.opened",
"idempotency_key": "<X-GitHub-Delivery>"
}
}X-GitHub-Deliverybecomes the idempotency key.- Signature verification happens before dispatch.
- The GitHub payload is passed through as the normalized
eventbody.