streamlit-coco
Bring Snowflake CoCo into Streamlit — streaming agent UI, tool cards you can actually read, and approval gates that fit governed data apps.
You own the page. CoCo owns the session. panel() streams the transcript; your app keeps st.chat_input, metrics, and forms. Approvals pause Write / Edit / Bash / SQL until someone clicks Approve once, Always allow, or Deny.
Alpha
0.1.0— API may still move. Star / watch the repo if you plan to ship on it.
Repo: github.com/lletourmy/streamlit-coco (temporary PyPI source) · Dev: streamlit-coco-dev
SDK docs: Cortex Code Agent SDK
Why this package
| Without streamlit-coco | With streamlit-coco |
|---|---|
| Wire CoCo yourself across Streamlit reruns | Session + fragment polling that keeps streaming |
| Raw JSON tool dumps | Meaningful cards (Glob, Grep, Read, Write, SQL, AskUser…) |
| Hope the agent behaves | require_approval_for + HITL UI |
| Chat-only demos | Structured callbacks into your own widgets |
Also: headless query() for scripts and CI, plus a legacy all-in-one chat() if you want built-in input.
Install
uv add "streamlit-coco[sdk]"
# or: pip install "streamlit-coco[sdk]"
From a clone (editable + tests):
make install
Prerequisites
- Python 3.10+ · Streamlit ≥ 1.53
- CoCo CLI on
PATH(cortex --version) - Authenticated Snowflake connection (
~/.snowflake/connections.tomlor equivalent) cortex-code-agent-sdk(pulled in by thesdk/devextras)
Full local setup: doc/deployment/local.md (CLI install, Snowflake connections.toml, running examples, troubleshooting).
API: doc/api.md.
Quickstart
Preferred pattern — you own the input; CoCo owns the session and output:
import streamlit as st
import streamlit_coco as st_coco
opts = st_coco.CocoOptions(
connection="analytics",
cwd=".",
allowed_tools=["Read", "Glob", "Grep"],
require_approval_for=["Edit", "Write", "Bash"],
)
env = st_coco.check_environment(connection=opts.connection)
if not st_coco.render_start_gate(opts, session_key="copilot", env=env):
st.stop()
session = st_coco.get_or_create_session(opts, key="copilot")
st_coco.panel(session=session, warm_up=True, show_status=True, run_every=0.25)
st_coco.chat_input_bar(session, placeholder="Ask CoCo…")
allowed_tools— may auto-run (enforced in Python when approvals are configured)require_approval_for— pause for Approve once · Always allow · Deny
Legacy all-in-one component (built-in input):
st_coco.chat(session=session, key="coco_chat", height=560)
Try the demos
make chat # panel + chat input + tool cards + approvals
make approval # legacy CCv2 chat
make structured # custom structured-output panel
make headless # asyncio query() pipeline
make backlog # Product Backlog Desk (multipage business demo)
Exploratory prompts: examples/testdata/prompts.json.
Backlog desk: examples/backlog_desk/README.md.
Patterns you’ll use often
Structured output → your widgets
output = st.container()
def render(data: dict, result: st_coco.CocoChatResult) -> None:
with output:
st.dataframe(data.get("selected_features", []))
st_coco.panel(session=session, on_structured_output=render)
Headless (no Streamlit UI)
import asyncio
import streamlit_coco as coco
async def run():
async for event in coco.query("Profile ANALYTICS.CUSTOMERS"):
if event.type == "result":
print(event.structured_output)
asyncio.run(run())
What’s inside
| Capability | Entry points |
|---|---|
| Native panel + approvals | panel(), chat_input_bar(), render_approvals() |
| Tool cards & AskUser / plan UI | see doc/features/tools-display/ |
| Session & options | CocoSession, CocoOptions, get_or_create_session |
| Headless events | query() |
| Legacy CCv2 | chat() |
API reference: doc/api.md.
Feature guides + release checklists: doc/features/README.md.
streamlit_coco/ # library (ui, session, permissions, tool cards, …)
examples/ # chat, approval, structured, headless demos
doc/ # PRD, roadmap, feature specs & checklists
tests/
Development
make install # uv sync --extra dev
make check # ruff + pytest
make audit # pip-audit
make format # ruff format + fix
make build # sdist + wheel
make sync-release # copy tree → ../streamlit-coco (see doc/deployment/publish.md)
make help # all targets
CI runs lint, tests, and pip-audit on every PR to main.
Releases: develop here (streamlit-coco-dev), sync + tag on lletourmy/streamlit-coco → PyPI (guide).
Docs: PRD · API · Roadmap · Deployment · Changelog · AGENTS.md
License
Apache-2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file streamlit_coco-0.1.0.tar.gz.
File metadata
- Download URL: streamlit_coco-0.1.0.tar.gz
- Upload date:
- Size: 295.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edca7a74082202c82baa3229439fb3053e082ef31a13c6637c801b9a62b564ca
|
|
| MD5 |
8fc2961407042a25c97d9e416cd5bad9
|
|
| BLAKE2b-256 |
4d3b22fb904223184a01870a970827768187e8058159d9d757cfb5bab574b0be
|
Provenance
The following attestation bundles were made for streamlit_coco-0.1.0.tar.gz:
Publisher:
release.yml on lletourmy/streamlit-coco
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
streamlit_coco-0.1.0.tar.gz -
Subject digest:
edca7a74082202c82baa3229439fb3053e082ef31a13c6637c801b9a62b564ca - Sigstore transparency entry: 2355928155
- Sigstore integration time:
-
Permalink:
lletourmy/streamlit-coco@83eb8570034b13264ec98bd91556a6fa94e4c333 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/lletourmy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83eb8570034b13264ec98bd91556a6fa94e4c333 -
Trigger Event:
push
-
Statement type:
File details
Details for the file streamlit_coco-0.1.0-py3-none-any.whl.
File metadata
- Download URL: streamlit_coco-0.1.0-py3-none-any.whl
- Upload date:
- Size: 56.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de6306cd250539cc3e2ea0927d7162f6e4ce8f82e13fa99bb0d477d098c72624
|
|
| MD5 |
ed1ea96fe6ed811dd044c6f31b3c2860
|
|
| BLAKE2b-256 |
d350a1012031ffdd3cbd57098c6e22c7375a3af70927bafd4082b2bf2d6895ef
|
Provenance
The following attestation bundles were made for streamlit_coco-0.1.0-py3-none-any.whl:
Publisher:
release.yml on lletourmy/streamlit-coco
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
streamlit_coco-0.1.0-py3-none-any.whl -
Subject digest:
de6306cd250539cc3e2ea0927d7162f6e4ce8f82e13fa99bb0d477d098c72624 - Sigstore transparency entry: 2355928915
- Sigstore integration time:
-
Permalink:
lletourmy/streamlit-coco@83eb8570034b13264ec98bd91556a6fa94e4c333 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/lletourmy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@83eb8570034b13264ec98bd91556a6fa94e4c333 -
Trigger Event:
push
-
Statement type: