Getting started
Access and prerequisites#
- Python >=3.10, a virtual environment, and Streamlit >=1.53.
- A Snowflake account with Cortex Code access, and a connection configured in
~/.snowflake/connections.toml(or the legacy~/.snowflake/config.toml). This library never stores or logs credentials itself — authentication is delegated to the CoCo CLI, the SDK, and the OS-level Snowflake config. - The
cortexCLI reachable onPATH, orCORTEX_CODE_CLI_PATHset to itslocation.
Installation and CLI setup are covered step by step in Enablement setup.html — follow that page first if you have not installed streamlit-coco yet. This page assumes installation is done and picks up from a working checkout.
First run#
- Confirm the environment is ready before writing any app code:
import streamlit_coco as st_coco env = st_coco.check_environment() print(env.ready, env.sdk_installed, env.cli_ok, env.snowflake_config_found)check_environment()never raises — it always returns aCocoEnvironment, so aFalsehere means something to fix, not a crash. See Concepts and API reference for every field. - Run the first-party demo to see a working app before writing your own:
make chatThis runs
examples/chat_app.py— the preferred integration pattern (check_environment→render_start_gate→get_or_create_session→panel()+chat_input_bar()) in the smallest working form. Details and the other example apps are in I want to run the example apps. - Build your own minimal app from the same pattern:
You're done when…#
check_environment().readyisTruefor the connection you intend to use.make chatopens a browser tab showing the CoCo panel, and a prompt youtype gets a streamed response.
- You can point to the four calls of the preferred pattern
(
check_environment→render_start_gate→get_or_create_session→panel()) inexamples/chat_app.pyand explain what each one does.
If check_environment() reports a problem, or the app gets stuck before a response appears, see FAQ or help.html in the Technical Guide.