Example applicationThis example creates a full web application that provides a chat interface for querying ClickHouse data.
You can find the source code for this example in the examples repository.
Prerequisites
- You’ll need to have Python installed on your system.
You’ll need to have
uvinstalled - You’ll need an Anthropic API key, or API key from another LLM provider
Create utilities file
Create autils.py file with two utility functions. The first is an
asynchronous function generator for handling stream responses from the
Agno agent. The second is a function for applying styles to the Streamlit
application:utils.py
Setup credentials
Set your Anthropic API key as an environment variable:Using another LLM providerIf you don’t have an Anthropic API key, and want to use another LLM provider,
you can find the instructions for setting up your credentials in the Agno “Integrations” docs
Import required libraries
Start by creating your main Streamlit application file (e.g.,app.py) and add the imports:Define the agent streaming function
Add the main agent function that connects to ClickHouse’s SQL playground and streams responses:Run the application
To start your ClickHouse AI agent web application you can run the following command from your terminal:http://localhost:8501 where you
can interact with your AI agent and ask it questions about the example datasets
available in ClickHouse’s SQL playground.