Develop handler for webhook connection
agent_id
: Agent id.run_id
: Agent run id.run_url
: Link to web UI of the run result.created
: Timestamp when the run result was created.updated
: Timestamp when the run result was last updated.files
: List of files of the run.order
: User specified order of the prompts for the agent. It is mainly used for UI display.data
: Prompt results of the run, a dictionary keyed by prompt name.KOLENA_WEBHOOK_SECRET
environment variable. When creating your own production server, you should use the secret generated by Kolena after creating the Webhook integration.
listen
command.
--forward
option.
You can use the secret from an existing webhook connection, if you already created one, or any arbitrary value for KOLENA_WEBHOOK_SECRET
, as we are just locally testing.
The secret passed to the CLI will be used by the restructured CLI to sign the request forwarded to your service.
The --tail <N>
option can be provided to fetch N
most recent results of the agent. If --tail
isn’t included, the command would only listen to new results.
You can test your agent with demo data without relying on the agent having active data using the sample
command.
X-Kolena-Timestamp
: Timestamp of the requestX-Kolena-Delivery-ID
: Unique id for the requestX-Kolena-Signature
: HMAC value of request body, timestamp, and Delivery ID signed with webhook secretX-Kolena-Signature
, X-Kolena-Timestamp
, and X-Kolena-Delivery-ID
, respectively.
Upon receiving a request, use the secret to compute the signature from the X-Kolena-Timestamp
, X-Kolena-Delivery-ID
and request body, and verify the signature you computed matches the value in X-Kolena-Signature
.
It is also advised to verify that X-Kolena-Timestamp
is within a short time window from the time the request is received.
Kolena provides a utility function webhook.construct_event
in our Python SDK. It performs signature verification and returns the parsed JSON object.