Use Cases
Just-in-time context enables you to:- Tailored user experience: Generate unique system prompts based on user data
- Session-specific configuration: Create specialized agents for individual sessions
- Context augmentation: Adapt agent behavior based on external data sources
Implementation
You can provide just-in-time context in the system prompt field of the Create Agent endpoint. Since agent creation is a lightweight operation, you can generate agents dynamically just before a conversation to inject just-in-time context. The response includes the agent ID, which you can use to share as a direct link (https://bey.chat/{agent-id}) or embed via iframe.
Agents created this way are typically single-use and disposable.
To keep your agent collection clean, delete them after use with the Delete Agent endpoint.
Conversations managed by these agents remain in your database.
Context During a Conversation
To update the agent while a conversation is ongoing, send context with the Send Context to Conversation endpoint. For example, a signing kiosk can tell the agent which document the user just opened:respond to false to only add the context, which the agent then uses in its next reply.
The endpoint answers 409 when the conversation room does not exist yet or has already ended.
Context sent after the room exists but before the agent has joined is dropped, although the endpoint answers 202.
The context reaches every participant of the conversation, so the user’s client can read it.
Do not send anything the user must not see.
Control characters are not allowed in the text.
It is available from the Growth Plan onwards.
Complete Example
See our just-in-time context example for full implementation including API integration, context injection, and conversation data retrieval:Just-in-Time Context Example
Complete implementation with code examples