Skip to main content

HTTP Webhook Adapter

The webhook adapter exposes HTTP endpoints for GitHub-style webhook ingress and generic HTTP clients.

Included in pip install agentix[gateway] (no extra required).

Setup

from agentix.gateway.adapters.webhook import WebhookAdapter

gateway.add_channel(
WebhookAdapter(
route="github", # registers POST /webhooks/github
secret="...", # optional HMAC secret for verification
extract_message=None, # optional: callable(request) -> str
)
)

Webhook endpoint

When a WebhookAdapter is registered, the gateway exposes:

POST /webhooks/{route_name}

For example, route="github"POST /webhooks/github.

YAML config

channels:
webhook_github:
type: webhook
route: github
secret: "${GITHUB_WEBHOOK_SECRET}"

Custom message extraction

By default, the adapter passes the full JSON body as text to the agent. Provide a custom extractor for structured payloads:

def extract_github_message(payload: dict) -> str:
event = payload.get("action", "unknown")
repo = payload.get("repository", {}).get("full_name", "")
return f"GitHub event '{event}' on {repo}"

gateway.add_channel(
WebhookAdapter(
route="github",
secret="...",
extract_message=extract_github_message,
)
)

Synchronous response

The adapter waits for the agent to complete and returns the result as the HTTP response body (plain text). Set a request timeout on the sender side accordingly.