In-chat context
This pattern covers ways users provide context to an agent during a chat interaction.
This pattern covers ways users provide context to an agent during a chat interaction.
The way context enters the conversation should reflect where it lives. External or third-party services may need authorization outside of the user’s environment. Local files need upload affordances. Knowledge in the user's head needs natural language.
After context is provided, the agent should acknowledge what it received and how it will use it. This builds trust that the context was correctly interpreted and gives users a chance to correct misunderstandings before the agent acts on them.
Context-adding should feel lightweight, not like filling out a form. Pre-fill what can be inferred, collapse completed steps, and avoid asking for information the system already has. The goal is to get from "user has context" to "agent has context" in as few interactions as possible.
Users connect a third-party service to give the agent access to existing resources. A multi-step inline flow handles authorization and resource selection directly in the conversation.
I need permission to read your repositories. This is a one-time authorization.
Users attach local files alongside their prompt to give the agent immediate access to relevant content like configuration files, documents, or images.
Users state project details, preferences, or constraints in natural language alongside their request. The agent confirms what it understood and applies it going forward. Use follow-up questions to clarify or gather additional details after context is provided.
Use sentence case, but continue to capitalize proper nouns and brand names correctly in context.
Use end punctuation, except in headers and buttons. Don’t use exclamation points.
Use present-tense verbs and active voice.
Don't use please, thank you, ellipsis (...), ampersand (&), e.g., i.e., or etc. in writing.
Avoid directional language.
For example: use previous not above, use following not below.
Use device-independent language.
For example: use choose or select not click.
Use a short, action-oriented label that describes what the user needs to do.
For example: Connect to repository or Select repository.
Confirm what context was connected or added. Include identifying details so users know exactly what context the agent now has. Follow writing guidelines for
For example: Successfully connected as John-Doe-Dev or Connected to repository.
Explain what permission is needed and why in one sentence.
For example: I need permission to read your repositories. This is a one-time authorization.
Follow the guidelines on alternative text and Accessible Rich Internet Applications (ARIA) regions for each component.
Make sure to define ARIA labels aligned with the language context of your application.
Don't add unnecessary markup for roles and landmarks. Follow the guidelines for each component.
Provide keyboard functionality to all available content in a logical and predictable order. The flow of information should make sense.