Skip to main content

The problem

Without context, each agent run is stateless. When a guest asks “I need towels for room B12” and the concierge replies “Large or small?”, the next message “medium” means nothing to the agent — it has no memory of the previous exchange.

How it works

WhatsRB automatically injects conversation context into each agent run, so the agent understands the conversation history:
  1. After each run, the agent generates a context_summary — a one-line snapshot of the conversation state (intent, extracted fields, pending questions).
  2. On the next inbound message from the same phone number, WhatsRB injects the previous run’s context_summary and last_agent_output (intent + actions) into the agent’s input.
  3. The agent uses this context to correctly interpret follow-up messages.
Context is scoped per agent + phone number. Two different agents or two different phone numbers never share context.

Configuration

Control context duration with context_ttl_minutes on the agent:

What gets injected

When a previous run exists within the TTL window, the agent receives two extra fields in its input:

Example flow

Without context, message 2 would be classified as unclear or misinterpreted. With context, the agent knows the guest is specifying towel size for room B12.

Interaction with Human Takeover

When a human takeover pause is active, the agent doesn’t run at all — so no context is generated during the pause. When the pause expires and the agent resumes, it picks up context from the last run before the pause (if still within TTL).

Best practices

  • Keep the default TTL (60 min) for most use cases. It covers natural conversation gaps without carrying stale context.
  • Increase to 120-240 min for async workflows where customers may reply hours later (e.g., B2B support).
  • Set to 0 for agents that handle fully independent requests (e.g., a pure classification agent with no follow-up expected).
  • The agent automatically generates context_summary — no prompt engineering needed. It’s built into the default tool schema.