Install any skill in seconds. Free to start, no credit card required.
Get Started Free →streamlit/understanding-streamlit-architecture
Explains Streamlit's internal architecture including backend runtime, frontend rendering, and WebSocket communication.
Passed 17 of 20 test cases with the skill, and 15 of 20 without it.
and 4 more in the full report
5 fixed14 passed either way1 still failing2 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 5 test cases the skill fixed. Same model, same prompt, with and without the skill.
When inspecting the frontend render tree structure in `frontend/lib/src/render-tree/AppRoot.ts`, how many root structural containers does `AppRoot` maintain, and what are their names?
| Checked | Without skill | With skill |
|---|---|---|
| States that AppRoot maintains 4 root containers | Missed | Passed |
| Lists main, sidebar, event, and bottom as the four root containers | Missed | Passed |
The instructions your model reads when the skill loads.
Streamlit is a client-server application with bidirectional WebSocket communication using Protocol Buffers.
Use this file as a quick mental model and navigation index; use references/backend.md, references/frontend.md, and references/communication.md for implementation details.
| Concept | Description | Key files |
|---|---|---|
| Command | Any function exposed in Streamlit's public API (st.* namespace). Commands can create elements/widgets, control execution flow, or configure app behavior. | lib/streamlit/delta_generator.py, lib/streamlit/elements/, lib/streamlit/commands/ |
| Element | Umbrella term for all UI components in Streamlit: widgets, containers, and display elements. Represented in Element.proto as a oneof union of ~50+ types. | proto/streamlit/proto/Element.proto, lib/streamlit/elements/ |
| Widget | Interactive element (button, slider, text_input) that typically triggers a rerun on user interaction. Value accessible via return value or st.session_state. Widgets that support on_change="ignore" update in the browser without rerunning until something else does. Some elements become widgets conditionally (e.g., dataframe/chart with on_select). | lib/streamlit/elements/widgets/, frontend/lib/src/components/widgets/ |
| Display Element | Non-interactive element (text, markdown, image, chart) that renders content without triggering reruns by itself. | lib/streamlit/elements/, frontend/lib/src/components/elements/ |
| Container | Layout block that groups elements spatially (sidebar, columns, expander, tabs, form). Represented as BlockNode in the element tree. | lib/streamlit/elements/layouts.py, Block.proto |
| DeltaGenerator | The st object; API entry point that queues UI deltas. Uses mixin pattern to compose all st.* commands. | lib/streamlit/delta_generator.py |
| Session State | Per-session dictionary (st.session_state) persisting data across reruns. Stores widget values and user variables. | lib/streamlit/runtime/state/session_state.py |
| Rerun | Re-execution of the user script for the current page. Triggered by widget interactions, st.rerun(), file changes, or fragment timers. Rebuilds the element tree while preserving session state. | lib/streamlit/runtime/scriptrunner/script_runner.py, lib/streamlit/commands/execution_control.py |
| Form | Container (st.form) that batches widget inputs, deferring reruns until form submission. | lib/streamlit/elements/form.py, WidgetStateManager.ts |
| Fragment | Decorator (@st.fragment) enabling partial reruns of specific UI sections without full script re-execution. | lib/streamlit/runtime/fragment.py |
| Caching | Decorators (@st.cache_data, @st.cache_resource) that memoize function results to avoid redundant computation. | lib/streamlit/runtime/caching/ |
| Pages | Multipage app system using st.navigation() and st.Page() or auto-discovery from pages/ directory. | lib/streamlit/navigation/, lib/streamlit/runtime/pages_manager.py |
| Config | App configuration via .streamlit/config.toml controlling server, client, and theme settings. | lib/streamlit/config.py, lib/streamlit/config_option.py |
| Theming | Customizable UI themes (Light/Dark/Custom) defined in config or via theme editor. | lib/streamlit/runtime/theme_util.py, frontend/lib/src/theme/ |
| Secrets | Secure credential storage via .streamlit/secrets.toml (local) or platform settings (deployed). Accessed via st.secrets. | lib/streamlit/runtime/secrets.py |
| Connection | Database/service abstraction (st.connection) with built-in caching and secrets integration. | lib/streamlit/connections/ |
| Custom Components | User-built extensions using React/iframe. v1 (legacy): declare_component() API. v2 (current): Bidirectional components with improved state management. | frontend/component-lib/, frontend/component-v2-lib/, lib/streamlit/components/v1/, lib/streamlit/components/v2/ |
| Static File Serving | Files in static/ directory served directly via /app/static/* (when static serving is enabled). | lib/streamlit/web/server/server.py, lib/streamlit/web/server/starlette/starlette_routes.py |
| App Testing | Testing framework (AppTest) for simulating user interactions and inspecting rendered output. | lib/streamlit/testing/ |
flowchart TB
subgraph Backend["Backend (Python)"]
Script[User Script]
DG[DeltaGenerator]
Runtime[Runtime/AppSession]
end
subgraph Protocol["WebSocket + Protobuf"]
test cases passed, vs 15 / 20 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.