Choose and switch the supplier context¶
Use a dedicated workflow to return supplier choices when the context picker opens and to filter those choices as the user searches.
Supplier Context workflow¶
flowchart TD
Start([Context picker request]) --> Route{"Switch · Message hint"}
Route -->|InitContextSuggestions| Load["Code · Load supplier choices"]
Route -->|QueryContextSuggestions| Filter["Code · Filter suppliers by name or ID"]
Load --> Initial["LLM · Show the available suppliers"]
Filter --> Matches["LLM · Show matching suppliers"]
Initial --> End([Return selectable choices])
Matches --> End
Configure the workflow¶
Expose DEMO_SUPPLIER_CONTEXT to Agentic Apps. Use the shared supplier fixture as the data source for both branches.
- Set the Switch case expression to
{{$context.$app.$OraMessageHint}}. Add cases forInitContextSuggestionsandQueryContextSuggestions. - On the initial path, return both suppliers as selectable items. Show the picker even when
$context.$app.$OraRequestDefaultAppContextis true so the user chooses a supplier at launch. - On the search path, read
{{$context.$system.$inputMessage}}and match the text against supplier names and IDs. Pass an empty list to the LLM when there are no matches. - On each path, select Messages List in the LLM node’s App Experience settings. Ask the LLM to display the supplier names and IDs and preserve each selection action. Build each action as a call to
ora.App.setContextwith the supplier ID as a plain string. - In App Builder, enable App Context Switching and select
DEMO_SUPPLIER_CONTEXTas its agent.
Run the example in Preview¶
Open the app without a supplier context, then search for Harbor. The request carries the QueryContextSuggestions hint and Harbor as its input message.
Sample workflow output
<oraInfoDisplay key="supplier-contexts">
{
"patternId": "messageListWidget",
"properties": {
"items": [
{
"title": "Harbor Office Supply",
"summary": "SUP-2108",
"action": "ora.App.setContext(\"SUP-2108\")"
}
]
}
}
</oraInfoDisplay>
Selecting the item sets $context.$app.$OraAppContext to SUP-2108.
Expected behavior¶
| Scenario | Expected behavior |
|---|---|
| Open the app without a context | Both suppliers appear as choices. |
Search for Harbor |
One choice appears and opens the workspace for SUP-2108. |
| Search for an unknown supplier | The picker receives an empty list. |
| Return to the picker | Choices appear again and selecting another supplier changes the app context. |
Related guides
App Context Switcher · Assemble the app