What the gateway does
Checkfu does not store the mapping from a provider conversation to a Session. Keep that mapping in your own database, keyed by your tenant and the provider’s conversation ID.
1. Create a Session for a new conversation
Create one Session the first time you see a conversation. Use a stableIdempotency-Key derived from your tenant and the provider’s conversation ID, so a retried webhook returns the same Session. Store the returned sess_… ID next to the conversation.
You need an existing Agent and Environment. The Quickstart creates both. Link CLI access before using the CLI tab.
acted_as. See Session identity.
2. Send each message as Session input
For every verified incoming message, post auser.message event. Use the provider’s message ID in the Idempotency-Key and in caused_by.request_id (1 to 512 characters). If the provider redelivers the message, the same key returns the same stored event.
seq.
3. Read the reply
Follow the event stream from just after your stored message, or page through the event log.agent.message events carry the reply text in payload.content. A session.status_idle whose stop_reason is not requires_action marks the end of the turn. See Events for the full catalog and Resume a stream for cursor handling.
seq you have delivered for each conversation. After a restart, resume from that cursor so you do not resend earlier replies.
4. Deliver the reply through the provider
Your gateway calls the provider’s send API with the reply text. Choose what to deliver. You can skipagent.thinking, tool events, and other internal events, and you can post a single message per turn.
If the Agent asks for an approval, the Session stops at a requires_action boundary. Show the request in your app, then decide it with the approval API. A button press in the provider is not a decision until your service calls actionApprovals.decide. See Handle an approval.
Your responsibilities
Delivery is not exactly-once
An idempotent API call and a stored event do not tell you whether the provider received your reply. If a send times out, you do not know whether the message arrived. Record the attempt and reconcile with the provider before you send again. Do not replay an uncertain send automatically. A successful create or input request also does not mean a model answered. Support depends on the Harness, Environment, model, and resource combination you select. Check capability status before relying on one.Next steps
Resume a stream
Keep a cursor so a restart does not resend or skip events.
Handle an approval
Decide an ActionApproval from your own interface.
Events
Look up the event types a gateway reads.
Add an agent to your app
Use the same Session API from any backend.