LiyaEngine Docs

Agents and requests that need a person

How an agent hands work that needs an approval to a workflow without making the customer wait, and how the outcome gets back to the same conversation.

Dashboard

Some things an agent cannot finish on its own: a hardship request that a person must approve, a refund over a limit, a document an analyst must check. The agent should not hold the customer's turn while it waits. It submits the request, tells the customer what to expect, and carries on. When a person decides, the outcome returns to the same conversation.

Customer ──▶ your app ──▶ agent
                            │ answers, looks things up, classifies: instant, in the conversation
                            │ submit_case(details) ──▶ workflow ──▶ approver
                            ◀── reference, due_by
         "Sent for review, reference …, reply by Tuesday"

   hours later
approver decides ──▶ LiyaEngine ──(signed POST: agent.request_decided)──▶ your app
your app ──▶ run(session_key, event: { reference }) ──▶ agent tells the customer

Two kinds of tool

InstantDeferred
WhatIntents, knowledge search, actionsA workflow with an approval or a delay
The agentWaits for the result, in secondsGets a reference at once and carries on
The customer hearsThe answerWhat was sent, a reference, and when to expect a reply

Do the live work in the conversation and send only the part that needs a person to the workflow. A workflow an agent uses should start at the approval, not repeat a step the agent already did, and takes what the agent worked out as inputs.

1. Name the conversation

Send your own id as session_key with the end user's user_id. You do not store a LiyaEngine id.

POST /v1/agents/loan-support/run
{ "session_key": "conv_55", "input": { "user_id": "cust_812", "message": "I can't pay this month." } }

2. What the agent does

When the agent calls the workflow, it gets this back instead of waiting:

{
  "status": "submitted",
  "reference": "cmw8r1tg9001pzz22xk2m1e0a",
  "due_by": "2026-11-26T10:00:00.000Z",
  "message": "…tell the customer it was sent, give them the reference and say a reply is expected by the due_by time…"
}

due_by comes from the approval step's time limit. An approval with no limit has due_by: null, and the agent does not promise a time. A workflow the build assistant creates has a 48 hour limit that rejects, so every request ends.

The agent also has a read-only check request status tool. If the customer asks "any news?", it looks the reference up and answers with pending, approved, rejected, expired, completed, failed or in_progress. It can only see requests made in its own conversation.

3. Hear the outcome

In Administration → Webhooks, add an endpoint for agent.request_decided (see Webhooks and approvals in your own app for the signature check and retries). Delivery is signed, retried, and at least once, so key your handling on reference and outcome, or on the X-Liya-Event-Id header.

{
  "reference": "cmw8r1tg9001pzz22xk2m1e0a",
  "outcome": "approved",
  "decided_at": "2026-11-24T09:12:40.000Z",
  "session_key": "conv_55",
  "user_id": "cust_812",
  "agent_key": "loan-support"
}

The event carries no details of the request. Your app decides what to show and when.

4. Continue the conversation

POST /v1/agents/loan-support/run
{ "session_key": "conv_55", "input": { "user_id": "cust_812", "event": { "reference": "cmw8r1tg9001pzz22xk2m1e0a" } } }

The agent is told how the request ended, from LiyaEngine's own record, and tells the customer what it means and what happens next. If the customer returns first, their next message works the same way: the agent checks the status and answers.

When nothing happens

SituationWhat the customer gets
The approver does not decideThe step's time limit applies its automatic outcome. The event is still sent, so the customer hears the result
The request is rejectedThe agent says it was not approved and offers the next step from its goal
Your webhook is downDelivery is retried. The status tool still returns the real outcome when the customer asks
The same key is sent for another userA different, empty conversation. It never reaches the first user's

Sessions, runs and approvals are kept for 90 days by default, so a conversation can resume well after a decision.

Build it with the assistant

Build → Build with AI plans this shape for you. An agent that needs a person is given a workflow that starts at the approval, with inputs for what the agent passes in, and the workflow is built before the agent. Everything is created as a draft. An agent can only call a workflow that is live, so deploy the workflow to let the agent hand work over, and switch on the intents it calls.

On this page