Skip to content

Definition of Agent Response Time

🧭 1. Understanding the Context

There are three message types:

  • TYPE_USER_IN → user sends a message (customer).
  • TYPE_BOT_OUT → bot replies.
  • TYPE_AGENT_OUT → live agent replies.

Agents may join mid-conversation, where the bot is already replying automatically. When the agent replies, the bot pauses temporarily.

The goal is to measure:

“How long it takes an agent to respond to a user’s message that needs human attention.”

🧩 2. Core Definition of Agent Response Time

Agent Response Time (ART) =

The time difference between the user’s last message that requires a human response and the agent’s first outgoing message after that.

However, since a bot might respond automatically before the agent takes over, we need to ignore bot messages when computing ART.

That means:

  • Only measure from the user’s message (TYPE_USER_IN)
  • To the next agent reply (TYPE_AGENT_OUT)
  • While ignoring intermediate bot messages (TYPE_BOT_OUT)

🧠 3. Rules for Accurate Measurement

Case | Description | Should Count as Response Time?

User sends message → Agent replies directly | Standard case | ✅ Yes

User sends message → Bot replies → Agent later joins | Agent took over after bot | ✅ Yes (start from user message, not bot)

Bot sends proactive message → Agent replies | No user message triggered it | ❌ No

Agent replies to another agent | Internal collaboration | ❌ No

Agent replies after user message but after a long gap (bot paused, waiting for agent) | Still counts | ✅ Yes

User sends multiple messages before agent replies | Use the last user message before the agent reply | ✅ Yes

🧮 4. Algorithm / Logic Flow

You can calculate the agent response time like this:

  1. For each TYPE_AGENT_OUT message:
    • Look backward in time for the most recent TYPE_USER_IN message.
    • Ignore any TYPE_BOT_OUT or TYPE_AGENT_OUT messages in between.
    • Compute the time difference: ART = agent_out.timestamp - user_in.timestamp
  2. Exclude:
    • If there is no prior TYPE_USER_IN.
    • If the last message before agent reply was another agent message.
    • If the agent message is part of a rapid sequence (same agent continuing conversation).

If the agent sends multiple messages in a row, only the first message after the user input counts as a “response.”

🧾 5. Scenarios & Examples

🧩 Scenario A: Basic Case

Timestamp | Type | Message

10:00:00 | TYPE_USER_IN | "Hi, I need help"

10:00:05 | TYPE_BOT_OUT | "Hello! How can I assist you?"

10:00:20 | TYPE_AGENT_OUT | "Hi John, I’ll help you with that."

Agent Response Time = 10:00:20 − 10:00:00 = 20s

✅ Counted — even though bot replied first.

🧩 Scenario B: Bot Handles First, Then Agent Joins Later

Time | Type | Message

11:00:00 | TYPE_USER_IN | "Can I get a refund?"

11:00:03 | TYPE_BOT_OUT | "Please provide your order ID."

11:00:10 | TYPE_USER_IN | "Order #12345"

11:00:12 | TYPE_BOT_OUT | "Refund requests usually take 3 days..."

11:00:40 | TYPE_AGENT_OUT | "Hi, I can confirm your refund has been processed."

✅ Response time = 11:00:40 − 11:00:10 = 30s
(last user message before agent reply)

🧩 Scenario C: Agent Replies to Agent

Time | Type | Message

12:00:00 | TYPE_AGENT_OUT | "Please handle this ticket."

12:00:05 | TYPE_AGENT_OUT | "Sure, on it."

❌ No response time recorded — internal agent-to-agent.

🧩 Scenario D: Multiple User Messages Before Agent

Time | Type | Message

13:00:00 | TYPE_USER_IN | "Hello"

13:00:05 | TYPE_USER_IN | "Is anyone there?"

13:00:10 | TYPE_AGENT_OUT | "Yes, I’m here."

✅ Response time = 13:00:10 − 13:00:05 = 5s

(Use the most recent user message)

🧩 Scenario E: User Message After Agent Is Already Active

Time | Type | Message

14:00:00 | TYPE_AGENT_OUT | "Hello! How can I help?"

14:00:05 | TYPE_USER_IN | "I need to change my email."

14:00:10 | TYPE_AGENT_OUT | "Sure, I can do that."

✅ Response time = 14:00:10 − 14:00:05 = 5s