When Context Is Sent to the Agent
Last updated: August 11, 2026
Dynamic Context is attached when Docket creates a new conversation. Set or reset context before that request begins.
Context Lifecycle
Stage | What happens |
|---|---|
| The widget validates the object, encrypts it, and stores the pending payload in the browser. |
Conversation creation | The widget includes the pending encrypted payload as |
Successful acknowledgement | Docket stores the new conversation ID and clears the pending browser buffer. |
Failed conversation request | The widget keeps the pending buffer so the request can be retried. |
Active conversation | Calling |
Correct Sequence
const result = await window.AISeller.setContext({
name: "Jordan",
company: "Northstar Labs"
});
if (result.success) {
window.AISeller.showAndConnect();
} else {
console.warn(result.message);
}Wait for setContext() to finish and confirm success: true before starting the conversation.
Common Timing Patterns
Scenario | When to set context |
|---|---|
Logged-in visitor | After identity data is available and before the visitor starts the agent. |
Form submission | After successful field validation and before |
Standalone or iframe URL | Include |
Visitor logout | Call |
Single-page application route change | Set the complete new context object before starting the next conversation. |
Verify the Timing
Open the deployed experience in a private browser window.
Call
setContext()and inspect the resolved result.Confirm
successistruebefore starting the conversation.Start the conversation and verify the expected value is used.
Call
setContext()again during the active conversation and confirm it does not rewrite that conversation's starting context.Start a new conversation and confirm the new payload is used.