AI Agent Session Manager with Webhooks, TTL & Handoff (n8n)
AI Agent Session Manager with Webhooks, TTL & Handoff (n8n)
Regular price
£75.99
Regular price
£75.99
Sale price
Unit price
/
per
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
Couldn't load pickup availability
🔥
128+ Sold
Popular with n8n builders
âš¡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
AI Agent Session Manager with Webhooks, TTL & Handoff (n8n)
Regular price
£75.99
Regular price
£75.99
Sale price
Unit price
/
per
Manage AI agent sessions automatically with webhooks, TTL expiry, and human handoff in n8n
This n8n workflow provides two POST webhooks that create, resume, pause, and close AI agent sessions stored in an n8n Data Table. It also supports TTL-based expiration, optional message deduplication via message_id, and human handoff routing—returning a clear session context payload for downstream automation.
What this workflow does
Webhook 1: Session lifecycle (message in)
- Accepts an incoming message payload and normalizes it (expects
user_key,message, and optionalmessage_id). - Loads session configuration such as TTL, pause defaults, and whether to enable message deduplication.
- Looks up the latest session for the user in the Data Table and evaluates session state.
- Decides the next action: create a new session, continue an active session, ignore duplicate
message_id, auto-resume after pause, or start a new session if the previous one is expired/closed. - Writes the resulting session state back to the Data Table (insert new session or update existing status; marks old sessions as expired when needed).
- Returns a session context response including action, thread_key, status, and expiry/pause metadata for downstream agent execution or waiting/handoff.
Webhook 2: Control commands (pause/handoff/resume/close)
- Receives control commands via a second POST webhook (pause, handoff, resume, close).
- Updates the session state in the Data Table and returns a control result payload.
Use cases
- Customer support AI that pauses for escalation and triggers human handoff when needed.
- Chat agents that safely handle retries and prevent double-processing with message deduplication.
- Session-based assistants where TTL expiration automatically starts fresh threads after inactivity or closure.
Technical details
- Implemented with nodes: code, switch, webhook, data table, and sticky note.
- Requires an n8n Data Table named agent_sessions with columns including
user_key,session_id,thread_key,status, timestamps, handoff/close fields, andlast_message_id.
