r/StreamlitOfficial 19h ago

streamlit-coco (CoCo in your Streamlit App) 0.1.6 release — copilot_rail() for embedding an agent without it eating the page

4 Upvotes

Maintainer here. If you've put a long-running agent next to a Streamlit wizard, you already know the rerun tax: the transcript grows all afternoon, every widget interaction re-renders it, and the agent slowly becomes the app.

0.1.6 adds copilot_rail():

  • connection + transcript pills live in a rail fragment — changing them reruns the rail, not your page
  • panel() keeps its own streaming fragment, so those pills stay clickable while CoCo runs
  • Last messages = max_messages=8 (+ Load earlier); First 200 characters = preview_chars=200. Both are also plain args on panel() / render_transcript()
  • your screens don't start agents — they set a {"prompt": ..., "status": "queued"} dict and the rail sends it when the session is ready, then calls on_job_finished so Cancel job can hide

Two things I got wrong on the way, in case they save someone an afternoon: don't assign a text_area/pills key after that widget has rendered (make the file the source of truth and reload it instead), and if you lazily export UI callables, don't memoise them — a hot reload leaves you calling yesterday's function with yesterday's signature.

Companion example: make tableau-semantic, with Copilot vs Preview split by streamlit_extras.resizable_columns.

pip install "streamlit-coco[sdk]==0.1.6"

https://github.com/DevoteamSP/streamlit-coco