Writing Streamlit Apps
PostHog/posthog
Write Streamlit app source code that runs well in a PostHog sandbox — the posthogapps.query() bridge for reading PostHog data, the packages baked into the sandbox image, caching and session state…
Agent skill
by iusztinpaul in iusztinpaul/designing-real-world-ai-agents-workshop
Using st.sessionstate to manage state across Streamlit reruns.
$ npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install iusztinpaul/designing-real-world-ai-agents-workshop using-streamlit-session-state --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state .claude/skills/using-streamlit-session-state && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "using-streamlit-session-state" agent skill from https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop/tree/main/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state into .claude/skills/using-streamlit-session-state/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "using-streamlit-session-state", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop/tree/main/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-stateType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install iusztinpaul/designing-real-world-ai-agents-workshop using-streamlit-session-state --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state .agents/skills/using-streamlit-session-state && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "using-streamlit-session-state" agent skill from https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop/tree/main/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state into .agents/skills/using-streamlit-session-state/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "using-streamlit-session-state", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install iusztinpaul/designing-real-world-ai-agents-workshop using-streamlit-session-state --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state .cursor/skills/using-streamlit-session-state && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "using-streamlit-session-state" agent skill from https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop/tree/main/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state into .cursor/skills/using-streamlit-session-state/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "using-streamlit-session-state", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop.git --path .agents/skills/developing-with-streamlit/skills/using-streamlit-session-state--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install iusztinpaul/designing-real-world-ai-agents-workshop using-streamlit-session-state --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state .gemini/skills/using-streamlit-session-state && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "using-streamlit-session-state" agent skill from https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop/tree/main/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state into .gemini/skills/using-streamlit-session-state/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "using-streamlit-session-state", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install iusztinpaul/designing-real-world-ai-agents-workshop using-streamlit-session-stateInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state .github/skills/using-streamlit-session-state && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "using-streamlit-session-state" agent skill from https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop/tree/main/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state into .github/skills/using-streamlit-session-state/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "using-streamlit-session-state", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install iusztinpaul/designing-real-world-ai-agents-workshop using-streamlit-session-state --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state .opencode/skills/using-streamlit-session-state && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "using-streamlit-session-state" agent skill from https://github.com/iusztinpaul/designing-real-world-ai-agents-workshop/tree/main/.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state into .opencode/skills/using-streamlit-session-state/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "using-streamlit-session-state", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
using-streamlit-session-stateUsing st.sessionstate to manage state across Streamlit reruns.
Using Streamlit Session State is an agent skill from iusztinpaul/designing-real-world-ai-agents-workshop. Using st.sessionstate to manage state across Streamlit reruns. Use when persisting data, handling widget state, implementing callbacks, or debugging state issues. Covers initialization patterns, widget-state association, and common gotchas.
Its SKILL.md is about 1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Agent Workflows, covering Session handoff. It works with Streamlit. The repository describes itself as: Hands-on workshop: Build a multi-agent AI system from scratch — Deep Research Agent + Writing Workflow served as MCP servers. Includes code, slides, and video. The licence is Apache-2.0.
Read from SKILL.md and the folder at commit ea4f6e9. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are python).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
docs.streamlit.ioFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Using Streamlit Session State loads about 1k tokens when it runs. Until then it costs about 68 tokens; SKILL.md has 216 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from iusztinpaul/designing-real-world-ai-agents-workshop at commit ea4f6e9, republished under its Apache-2.0 licence (© iusztinpaul). 216 words, ~1,001 tokens.
.claude/skills/using-streamlit-session-state/SKILL.md (or your agent's skills folder).Streamlit reruns scripts top-to-bottom on every interaction. Without session state, variables reset each time. Use st.session_state to persist values across reruns.
Session state is a dictionary-like object supporting attribute and bracket notation:
# Initialize with setdefault (preferred)
st.session_state.setdefault("count", 0)
# Alternative: check before setting
if "count" not in st.session_state:
st.session_state.count = 0
# Read
current = st.session_state.count
# Update
st.session_state.count += 1
st.session_state["count"] = 5 # Bracket notation also works
# Delete
del st.session_state.countAccessing uninitialized keys raises KeyError. Use st.session_state.get("key", default) for safe access.
Every widget with a key parameter automatically syncs to session state:
name = st.text_input("Name", key="user_name")
# st.session_state.user_name contains the same value as `name`Callbacks execute before the script reruns, allowing immediate state changes. Use on_change or on_click with optional args and kwargs:
def increment(amount):
st.session_state.count += amount
st.button("Add 5", on_click=increment, args=(5,))Access a widget's value in its own callback via st.session_state.key, not the return variable.
Initialize all state at the top of your app for clarity:
st.session_state.setdefault("user", None)
st.session_state.setdefault("page", "home")
st.session_state.setdefault("filters", {})Widgets are NOT stateful across pages. Their values reset when navigating between pages.
Use session state variables (not widget keys) to share data:
# Page 1: Store value
st.session_state.selected_user = st.selectbox("User", users)
# Page 2: Read stored value
if "selected_user" in st.session_state:
st.write(f"Selected: {st.session_state.selected_user}")Put common widgets in the entrypoint file (before nav.run()):
# app.py (entrypoint)
with st.sidebar:
st.session_state.theme = st.selectbox("Theme", ["Light", "Dark"])
nav = st.navigation(pages)
nav.run()# BAD: In imported modules, this is shared across ALL users
# utils.py
cache = {} # Persists across reruns AND users!
# GOOD: Use session state for per-user data
st.session_state.setdefault("cache", {})Cannot assign to a widget's state after the widget has rendered:
st.slider("Value", key="my_slider")
st.session_state.my_slider = 50 # Raises StreamlitAPIException!value parameter and session stateDon't set both—it causes warnings:
# BAD: Conflicting sources
st.session_state.setdefault("name", "Alice")
st.text_input("Name", value="Bob", key="name") # Warning!
# GOOD: Use one or the other
st.session_state.setdefault("name", "Alice")
st.text_input("Name", key="name")© iusztinpaul, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in .agents/skills/developing-with-streamlit/skills/using-streamlit-session-state of iusztinpaul/designing-real-world-ai-agents-workshop.
Open the folder on GitHubat commit ea4f6e9
Using Streamlit Session State next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Using Streamlit Session State this skilliusztinpaul/designing-real-world-ai-agents-workshop | 513 | — | ~1k | Automated safety check: Pass | Apache-2.0 | |
| Writing Streamlit AppsPostHog/posthog | 40k | — | ~1.5k | Automated safety check: Pass | Custom licence | |
| Developing With Streamlitstreamlit/agent-skills | 223 | — | ~412 | Automated safety check: Pass | Apache-2.0 | |
| Orca CLIstablyai/orca | 87k | 2 repos | ~593 | Automated safety check: Pass | MIT | |
| Coding Agent Session Findercode-yeongyu/oh-my-openagent | 70k | 1 repos | ~2.8k | Automated safety check: Pass | Custom licence | |
| Beads Task Memorygastownhall/beads | 28k | — | ~1.2k | Automated safety check: Pass | MIT |
PostHog/posthog
Write Streamlit app source code that runs well in a PostHog sandbox — the posthogapps.query() bridge for reading PostHog data, the packages baked into the sandbox image, caching and session state…
streamlit/agent-skills
A skill your agent uses for ALL Streamlit tasks: creating, editing, debugging, beautifying, styling, theming, optimizing, or deploying Streamlit apps.
stablyai/orca
Operate Orca-managed worktrees, folder contexts, terminals, repos, automations, artifacts, skill sharing, worktree comments, and Orca's embedded browser…
code-yeongyu/oh-my-openagent
Finds, reads and reconstructs past coding-agent sessions across Codex, Claude, OpenCode, Senpi and many other local agent logs.
gastownhall/beads
Tracks multi-session work with dependencies in the bd issue tracker so the agent can find ready tasks and recover its context after conversation compaction.
slopus/happy
Searches past Claude Code, Codex and Cursor sessions and summarizes what was worked on, tried or decided, using extraction scripts instead of reading raw logs.
iusztinpaul/designing-real-world-ai-agents-workshop
Builds bidirectional Streamlit Custom Components v2 (CCv2) using st.components.v2.component.
iusztinpaul/designing-real-world-ai-agents-workshop
Building chat interfaces in Streamlit. An agent skill from iusztinpaul/designing-real-world-ai-agents-workshop.
iusztinpaul/designing-real-world-ai-agents-workshop
Building dashboards in Streamlit. An agent skill from iusztinpaul/designing-real-world-ai-agents-workshop.
iusztinpaul/designing-real-world-ai-agents-workshop
Building multi-page Streamlit apps. An agent skill from iusztinpaul/designing-real-world-ai-agents-workshop.
iusztinpaul/designing-real-world-ai-agents-workshop
Choosing the right Streamlit selection widget. An agent skill from iusztinpaul/designing-real-world-ai-agents-workshop.
iusztinpaul/designing-real-world-ai-agents-workshop
Connecting Streamlit apps to Snowflake. An agent skill from iusztinpaul/designing-real-world-ai-agents-workshop.
Works with
Categories
Using st.sessionstate to manage state across Streamlit reruns. Using Streamlit Session State is an agent skill from iusztinpaul/designing-real-world-ai-agents-workshop.sessionstate to manage state across Streamlit reruns.
Using Streamlit Session State fits situations like: persisting data; handling widget state; implementing callbacks; debugging state issues.
Run `npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a claude-code`. Or copy the skill folder (.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state in iusztinpaul/designing-real-world-ai-agents-workshop) into .claude/skills/using-streamlit-session-state in your project. Claude Code loads it when a task matches its description.
Run `npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a codex`. Or copy the skill folder (.agents/skills/developing-with-streamlit/skills/using-streamlit-session-state in iusztinpaul/designing-real-world-ai-agents-workshop) into .agents/skills/using-streamlit-session-state in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add iusztinpaul/designing-real-world-ai-agents-workshop --skill using-streamlit-session-state -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/using-streamlit-session-state, .gemini/skills/using-streamlit-session-state, .github/skills/using-streamlit-session-state and .opencode/skills/using-streamlit-session-state in your project.
SKILL.md names no scripts, command-line tools or credentials: Using Streamlit Session State is instructions for the agent only. Our summary lists: Python 3.
SKILL.md names 1 domain. As links in the text: docs.streamlit.io. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Using Streamlit Session State is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 1k tokens (SKILL.md is roughly 4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Using Streamlit Session State: Writing Streamlit Apps (PostHog/posthog, 40k stars), Developing With Streamlit (streamlit/agent-skills, 223 stars), Orca CLI (stablyai/orca, 87k stars) and Coding Agent Session Finder (code-yeongyu/oh-my-openagent, 70k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
iusztinpaul (a GitHub user) maintains it in iusztinpaul/designing-real-world-ai-agents-workshop, which has 513 GitHub stars. The repository holds 23 skills in this directory. The repository was last updated on June 3, 2026.
Source: iusztinpaul/designing-real-world-ai-agents-workshop on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.