Managing Streamlit Apps

作者 PostHog469d1773e9cb無授權條款收錄於 2026年10月8日更新於 2026年10月8日

Create, deploy, and operate Streamlit apps in PostHog via the streamlit-apps MCP tools — create an app, set its source, start and stop its sandbox, poll status, list versions, delete, and share the app with humans via its PostHog URL. Use when asked to "create a streamlit app", "deploy a data app", "ship a dashboard app", "restart/stop my app", "why is my app not running", or "give me a link to the app".

僅含說明DevOps & Cloud
AI 產生的概覽

說明如何透過 streamlit-apps MCP 工具在 PostHog 中建立、部署與維運 Streamlit 應用程式。

功能
此技能說明託管於 PostHog 沙箱中的 Streamlit 資料應用程式完整生命週期:建立應用程式、上傳完整原始碼與輔助檔案及資源、啟動與停止沙箱、輪詢狀態、列出版本、更新名稱或規格,以及刪除應用程式。它說明版本如何建立並啟用、資料存取權限如何跟隨作用中版本的作者,以及如何透過應用程式在 PostHog 中需登入的網址分享應用程式。它也涵蓋啟動失敗、功能旗標回傳 403、程式碼未更新與查詢錯誤等疑難排解步驟。
適用情境
當被要求建立 Streamlit 應用程式、部署資料應用程式、發布儀表板應用程式、重新啟動或停止應用程式、診斷應用程式為何無法執行,或提供應用程式連結時使用。前提是 PostHog 中已提供 streamlit-apps MCP 工具。
執行需求
需要 streamlit-apps MCP 工具,以及可存取已啟用 streamlit-apps 功能旗標的 PostHog 專案;檢視者必須登入 PostHog。此技能不含指令碼,僅為指示文件,並引用另一個 writing-streamlit-apps 技能來撰寫應用程式原始碼。

Managing Streamlit apps

A Streamlit app is a Python data app running in an isolated sandbox inside PostHog. Each app has immutable versions of its code; one version is active; a sandbox process serves the active version. The full lifecycle is driven with the streamlit-apps-* MCP tools.

The happy path: create → set source → start → share

  1. streamlit-apps-create with a name (optionally description, cpu_cores 0.25–8, memory_gb 0.5–16, defaults 0.5 / 1). The app exists but has no code yet.
  2. streamlit-apps-set-source with the complete app.py source as one string. Extra files ride along in the same call: files maps a project-relative path to text (helper modules, CSV, JSON), assets maps a path to base64 (Parquet, images). This creates version 1 and activates it. Write the source per the writing-streamlit-apps skill — in particular use posthog_apps.query() for PostHog data, never import posthog.
  3. streamlit-apps-start. Returns immediately; the sandbox boots asynchronously.
  4. Poll streamlit-apps-status until status is running (typically well under a minute). If it lands on error, read last_error — see Troubleshooting below.
  5. Share the app: the _posthogUrl returned by create/get/start (/streamlit-apps/{short_id}) is the app's page in PostHog. That link is what you give humans. Viewers need to be logged into PostHog with access to the project (the app renders in an authenticated iframe; there is no public URL).

Whose data the app reads

The app's queries run with the data access of the person who authored the active version — set the source, and the app reads what you can read. Anyone who can view the app sees those results, so treat publishing an app as sharing that data with everyone on the project. An app whose version author has since been deleted can't start; upload a new version to fix it.

Updating code

Call streamlit-apps-set-source again: it creates the next version and activates it. Every call ships the complete app, so pass files and assets again too; a version holds only what that call carried. A running sandbox is stopped so it can't keep serving stale code — call streamlit-apps-start afterwards to serve the new version. Versions are immutable, but not permanent: streamlit-apps-versions lists the newest 50, and non-active versions older than 30 days are deleted along with their code. There is no rollback tool: to roll back, set the old source, files, and assets again, so a rollback needs a saved copy of the complete bundle. Fetch that copy from your conversation or wherever it's kept — versions store the zip, not an inline source view.

Stopping, idling, and deleting

  • streamlit-apps-stop stops the sandbox; code and versions are untouched. Starting again later is cheap.
  • Idle sandboxes are stopped automatically after a period of no activity — a stopped app is normal, not an error. Start it again when needed.
  • streamlit-apps-delete stops any sandbox and soft-deletes the app. Confirm with the user before deleting anything you didn't create in this conversation.

Troubleshooting

  • status: error with last_error: "Start failed: ..." — the sandbox failed to provision or boot. Retry streamlit-apps-start once; if it persists, surface last_error to the user (provisioning failures are usually platform-side, not app-side).
  • Tool calls return 403 "Streamlit apps is not available." — the streamlit-apps feature flag is off for this organization. This is a rollout gate, not an error you can fix; tell the user.
  • App runs but a query inside it fails — that's an app-code concern; see writing-streamlit-apps (bridge limits: 30s execution, 256 MB memory per query).
  • App shows old code after set-source — you skipped step "start after set-source"; the sandbox was stopped and needs a start.

Renaming and resizing

streamlit-apps-update changes an app's name, description, cpu_cores (0.25–8), or memory_gb (0.5–16); only the fields you pass change. New sizing applies the next time the sandbox starts, so stop + start after resizing a running app. Defaults (0.5 CPU / 1 GB) fit typical dashboard apps. Raise memory_gb only when the app itself holds large DataFrames in memory — the 256 MB HogQL bridge query cap is server-side and does NOT change with sandbox sizing, so bigger sandboxes don't fix failing queries.

來源與署名

來源:PostHog/ai-plugin位於skills/managing-streamlit-apps提交469d177

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架

更多來自 PostHog/ai-plugin 的技能

Writing Simplified Technical English

PostHog

套用 ASD-STE100 簡化技術英語規則,讓代理撰寫的文字語意明確、方便執行。

Writing & Content2026年10月8日

Working With Task Comments

PostHog

透過 PostHog MCP exec 調度器讀取並解讀 PostHog 任務、成品和畫布上的留言。

Productivity & Workflow2026年10月8日

Working With Skills

PostHog

指導代理使用 PostHog 的 skill-* MCP 工具來探索、讀取、建立、更新與重構技能。

AI & Agents2026年10月8日

Working With Scouts

PostHog

說明如何把監看工作委派給 PostHog Signals 偵察代理、處理其回報,並長期調校整個代理團隊的操作手冊。

AI & Agents2026年10月8日

Validating And Publishing Canvases

PostHog

Validate and publish a canvas source project safely: the source-project shape, declared capabilities, reading the current version pointer, iterating on validation diagnostics, guarded publishing with expected_current_version_id, staging a draft build and promoting it, waiting out the queued build, and recovering from a 409 version_conflict or a 429 capacity limit without overwriting concurrent work. Use whenever a canvas edit is ready to save, a draft build is wanted, a canvas publish or build returns diagnostics or a conflict, or a task needs to understand canvas version history.

待分類2026年10月8日

Understanding Billing Usage

PostHog

Explains PostHog billing usage and spend from the customer's visible Billing MCP tools. Use when the user asks why usage or spend is high, which product or project is driving usage, what a usage type means, how to reduce usage, what changed over time, why they got a usage change alert, or whether a spike/drop alert was real or noisy. Also use before product-specific analytics skills when the user names a billable PostHog product metric such as events, recordings, feature flag requests, exceptions, survey responses, synced rows, logs, AI events, AI credits, or Inbox credits. Starts from Billing usage/spend tools, then routes to customer-visible product MCP surfaces for deeper investigation.

待分類2026年10月8日