Imperative UI state updates for model context
Use declarative UI context updates with data-llm attributes instead of imperative setWidgetState calls.
Introduce a declarative way to describe UI context by attaching a data-llm attribute directly to components. A Vite plugin can then scrape these attributes to automatically update the widgetState.
Updating the model's context imperatively on every UI interaction using functions like window.openai.setWidgetState.
This approach simplifies synchronization. The model receives the relevant UI context at the right time without developers needing to manually manage every interaction, leading to a cleaner implementation.
Avoid imperative UI state updates for model context in ChatGPT apps. Instead, use declarative data-llm attributes on components, processed by a Vite plugin, for automatic context synchronization.
- 15 lessons learned building ChatGPT Apps ↗OpenAI Developers Blog · OpenAI Developers Blog · Sep 3, 2026 · paraphrased
First seen on Subvolts Sep 3, 2026. Updated Sep 11, 2026. Spotted a problem? Tell us.
- 15 lessons learned building ChatGPT AppsOpenAI · OpenAI Developers Blog · Sep 3, 2026
The Playbook: reusable how-tos, prompts, configs and tips pulled out of the news.
- HeuristicDefine task completion clearly to avoid premature stoppingExplicitly define what 'done' means for a task to ensure AI models complete the full scope. · 10 min
- Anti-patternBuilding agent infrastructure from scratchAvoid piecing together agent infrastructure; use standardized SDKs and native sandbox support. · 5 min
- Setting tipAgent workspace portability with Manifest abstractionUse the Manifest abstraction to describe agent workspaces for portability across different providers. · 10 min
- ToolOpenAI Agents SDK for building agentsSDK for building agents that can inspect files, run commands, edit code, and work on long-horizon tasks. · 15 min
- Anti-patternOverly specific instructions for advanced AI modelsAvoid detailed itineraries; newer models handle nuance and ambiguity better. · 10 min
- Anti-patternPrompting AI to read all project docs before every editAvoid forcing AI to read extensive documentation before simple edits; use contextual pointers instead. · 10 min
Questions people ask
- Which AI tools does this work with?
- The sources used it with ChatGPT.
- Where did this come from?
- OpenAI Developers Blog (OpenAI Developers Blog). Subvolts collected, normalized and credited it; the link above opens the original.

