<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Displaying plots in custom AI Agents in Generative AI</title>
    <link>https://community.databricks.com/t5/generative-ai/displaying-plots-in-custom-ai-agents/m-p/127300#M1075</link>
    <description>&lt;P&gt;I am trying to build an agent that uses custom functions running python code. However, I can't find a way to make the agent display plots or images. How can I tackle this?&lt;/P&gt;</description>
    <pubDate>Mon, 04 Aug 2025 08:44:51 GMT</pubDate>
    <dc:creator>raresaxpo</dc:creator>
    <dc:date>2025-08-04T08:44:51Z</dc:date>
    <item>
      <title>Displaying plots in custom AI Agents</title>
      <link>https://community.databricks.com/t5/generative-ai/displaying-plots-in-custom-ai-agents/m-p/127300#M1075</link>
      <description>&lt;P&gt;I am trying to build an agent that uses custom functions running python code. However, I can't find a way to make the agent display plots or images. How can I tackle this?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2025 08:44:51 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/displaying-plots-in-custom-ai-agents/m-p/127300#M1075</guid>
      <dc:creator>raresaxpo</dc:creator>
      <dc:date>2025-08-04T08:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: Displaying plots in custom AI Agents</title>
      <link>https://community.databricks.com/t5/generative-ai/displaying-plots-in-custom-ai-agents/m-p/127302#M1076</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/174965"&gt;@raresaxpo&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Good day!&lt;BR /&gt;&lt;BR /&gt;The content was asked from GPT to make a structured response but the whole process is not from GPT.&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Step-by-Step Guide: Building an AI Data Visualization Agent&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;This guide provides a detailed walkthrough to help you build a fully functional AI data visualization agent using Together AI, E2B, and Streamlit. This agent will allow you to interact with your data using natural language and automatically generate various types of plots and charts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H4&gt;&lt;STRONG&gt;What You Will Build&lt;/STRONG&gt;&lt;/H4&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A Streamlit application that serves as an interactive data visualization assistant with the following features:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Natural Language Interface:&lt;/STRONG&gt; Ask questions about your data in plain English.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Multiple Visualization Types:&lt;/STRONG&gt; Automatically generates line, bar, scatter, pie, and bubble charts.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Secure Code Execution:&lt;/STRONG&gt; Uses E2B's sandboxed environment to safely run AI-generated code.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Real-time Display:&lt;/STRONG&gt; Visualizations are generated and displayed on the fly.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Interactive UI:&lt;/STRONG&gt; A simple Streamlit interface for uploading data and interacting with the agent.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Prerequisites&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before you begin, ensure you have the following installed and configured:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Python:&lt;/STRONG&gt; Version 3.10 or higher.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Code Editor:&lt;/STRONG&gt; We recommend VS Code or PyCharm.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Together AI API Key:&lt;/STRONG&gt; You can obtain a free key by signing up on the &lt;A class="" href="https://api.together.xyz/settings/api-keys" target="_blank" rel="noopener"&gt;Together AI website&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;E2B Code Interpreting API Key:&lt;/STRONG&gt; You can get a free key by signing up on the &lt;A class="" href="https://www.google.com/search?q=https://e2b.dev/docs/getting-started/api-key" target="_blank" rel="noopener"&gt;E2B website&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Git:&lt;/STRONG&gt; Installed on your machine to clone the repository.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Step 1: Setting Up the Environment&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, you need to set up your project environment by cloning the source code repository and installing the necessary libraries.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Open your terminal or command prompt.&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Clone the GitHub repository:&lt;/STRONG&gt; This command will download all the project files into a new folder named awesome-llm-apps.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Bash&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;git &lt;SPAN class=""&gt;clone&lt;/SPAN&gt; https://github.com/Shubhamsaboo/awesome-llm-apps.git&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Navigate to the project directory:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Bash&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;cd&lt;/SPAN&gt; starter_ai_agents/ai_data_visualisation_agent&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Install the required Python dependencies:&lt;/STRONG&gt; The requirements.txt file lists all the libraries needed for the application.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Bash&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;pip install -r requirements.txt&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Step 2: Creating the Streamlit Application&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you will create the main Python file for the application. The following code will handle all the logic, from user input to code execution and visualization display.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a new file&lt;/STRONG&gt; named ai_data_visualisation_agent.py in your project directory.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Add the following code&lt;/STRONG&gt; to the file. This code is broken down into sections for clarity.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Imports:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Python&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;import&lt;/SPAN&gt; os
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; json
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; re
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; sys
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; io
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; contextlib
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; warnings
&lt;SPAN class=""&gt;from&lt;/SPAN&gt; typing &lt;SPAN class=""&gt;import&lt;/SPAN&gt; Optional, List, Any, Tuple
&lt;SPAN class=""&gt;from&lt;/SPAN&gt; PIL &lt;SPAN class=""&gt;import&lt;/SPAN&gt; Image
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; streamlit &lt;SPAN class=""&gt;as&lt;/SPAN&gt; st
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; pandas &lt;SPAN class=""&gt;as&lt;/SPAN&gt; pd
&lt;SPAN class=""&gt;import&lt;/SPAN&gt; base64
&lt;SPAN class=""&gt;from&lt;/SPAN&gt; io &lt;SPAN class=""&gt;import&lt;/SPAN&gt; BytesIO
&lt;SPAN class=""&gt;from&lt;/SPAN&gt; together &lt;SPAN class=""&gt;import&lt;/SPAN&gt; Together
&lt;SPAN class=""&gt;from&lt;/SPAN&gt; e2b_code_interpreter &lt;SPAN class=""&gt;import&lt;/SPAN&gt; Sandbox&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Code Interpretation Function:&lt;/STRONG&gt; This function executes the AI-generated Python code in the E2B sandbox.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Python&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;def code_interpret(e2b_code_interpreter: Sandbox, code: str) -&amp;gt; Optional[List[Any]]:&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;with&lt;/SPAN&gt; st.spinner(&lt;SPAN class=""&gt;'Executing code in E2B sandbox...'&lt;/SPAN&gt;):
        stdout_capture = io.StringIO()
        stderr_capture = io.StringIO()

        &lt;SPAN class=""&gt;with&lt;/SPAN&gt; contextlib.redirect_stdout(stdout_capture):
            &lt;SPAN class=""&gt;exec&lt;/SPAN&gt; = e2b_code_interpreter.run_code(code)

        &lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;exec&lt;/SPAN&gt;.results&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;LLM Interaction Function:&lt;/STRONG&gt; This function sends the user's query and the dataset context to the LLM (Large Language Model) to get a Python code response.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Python&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;def chat_with_llm(e2b_code_interpreter: Sandbox, user_message: str, dataset_path: str):&lt;/SPAN&gt;
    system_prompt = &lt;SPAN class=""&gt;f"""You're a Python data scientist and visualization expert.
    Dataset at path '{dataset_path}'
    Analyze and answer with Python code."""&lt;/SPAN&gt;

    client = Together(api_key=st.session_state.together_api_key)
    response = client.chat.completions.create(
        model=st.session_state.model_name,
        messages=[
            {&lt;SPAN class=""&gt;"role"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"system"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"content"&lt;/SPAN&gt;: system_prompt},
            {&lt;SPAN class=""&gt;"role"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"user"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"content"&lt;/SPAN&gt;: user_message}
        ]
    )&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Dataset Handling Function:&lt;/STRONG&gt; This function uploads the user's file to the E2B sandbox.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Python&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;def upload_dataset(code_interpreter: Sandbox, uploaded_file) -&amp;gt; str:&lt;/SPAN&gt;
    dataset_path = &lt;SPAN class=""&gt;f"./{uploaded_file.name}"&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;try&lt;/SPAN&gt;:
        code_interpreter.files.write(dataset_path, uploaded_file)
        &lt;SPAN class=""&gt;return&lt;/SPAN&gt; dataset_path
    &lt;SPAN class=""&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class=""&gt;as&lt;/SPAN&gt; error:
        st.error(&lt;SPAN class=""&gt;f"Error during file upload: {error}"&lt;/SPAN&gt;)
        &lt;SPAN class=""&gt;raise&lt;/SPAN&gt; error&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Streamlit main Function:&lt;/STRONG&gt; This is the core of the application, which sets up the user interface, handles input, and calls the other functions.&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Python&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;def main():&lt;/SPAN&gt;
    st.title(&lt;SPAN class=""&gt;"AI Data Visualization Agent"&lt;/SPAN&gt;)

    &lt;SPAN class=""&gt;with&lt;/SPAN&gt; st.sidebar:
        st.header(&lt;SPAN class=""&gt;"API Keys and Model Configuration"&lt;/SPAN&gt;)
        st.session_state.together_api_key = st.sidebar.text_input(
            &lt;SPAN class=""&gt;"Together AI API Key"&lt;/SPAN&gt;, 
            &lt;SPAN class=""&gt;type&lt;/SPAN&gt;=&lt;SPAN class=""&gt;"password"&lt;/SPAN&gt;
        )
        st.session_state.e2b_api_key = st.sidebar.text_input(
            &lt;SPAN class=""&gt;"E2B API Key"&lt;/SPAN&gt;, 
            &lt;SPAN class=""&gt;type&lt;/SPAN&gt;=&lt;SPAN class=""&gt;"password"&lt;/SPAN&gt;
        )

    &lt;SPAN class=""&gt;# Model Selection&lt;/SPAN&gt;
    model_options = {
        &lt;SPAN class=""&gt;"Meta-Llama 3.1 405B"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo"&lt;/SPAN&gt;,
        &lt;SPAN class=""&gt;"DeepSeek V3"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"deepseek-ai/DeepSeek-V3"&lt;/SPAN&gt;,
        &lt;SPAN class=""&gt;"Qwen 2.5 7B"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"Qwen/Qwen2.5-7B-Instruct-Turbo"&lt;/SPAN&gt;,
        &lt;SPAN class=""&gt;"Meta-Llama 3.3 70B"&lt;/SPAN&gt;: &lt;SPAN class=""&gt;"meta-llama/Llama-3.3-70B-Instruct-Turbo"&lt;/SPAN&gt;
    }
    st.session_state.model_name = st.selectbox(
        &lt;SPAN class=""&gt;"Select Model"&lt;/SPAN&gt;,
        options=&lt;SPAN class=""&gt;list&lt;/SPAN&gt;(model_options.keys())
    )

    &lt;SPAN class=""&gt;# File Upload&lt;/SPAN&gt;
    uploaded_file = st.file_uploader(&lt;SPAN class=""&gt;"Choose a CSV file"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;type&lt;/SPAN&gt;=&lt;SPAN class=""&gt;"csv"&lt;/SPAN&gt;)
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; uploaded_file:
        df = pd.read_csv(uploaded_file)
        show_full = st.checkbox(&lt;SPAN class=""&gt;"Show full dataset"&lt;/SPAN&gt;)
        &lt;SPAN class=""&gt;if&lt;/SPAN&gt; show_full:
            st.dataframe(df)
        &lt;SPAN class=""&gt;else&lt;/SPAN&gt;:
            st.dataframe(df.head())

    &lt;SPAN class=""&gt;# Query Processing&lt;/SPAN&gt;
    query = st.text_area(
        &lt;SPAN class=""&gt;"What would you like to know about your data?"&lt;/SPAN&gt;,
        &lt;SPAN class=""&gt;"Can you compare the average cost between categories?"&lt;/SPAN&gt;
    )

    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; st.button(&lt;SPAN class=""&gt;"Analyze"&lt;/SPAN&gt;):
        &lt;SPAN class=""&gt;with&lt;/SPAN&gt; Sandbox(api_key=st.session_state.e2b_api_key) &lt;SPAN class=""&gt;as&lt;/SPAN&gt; code_interpreter:
            dataset_path = upload_dataset(code_interpreter, uploaded_file)
            code_results, llm_response = chat_with_llm(
                code_interpreter, 
                query, 
                dataset_path
            )

    &lt;SPAN class=""&gt;# Visualization Display and Error Handling&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;if&lt;/SPAN&gt; code_results:
        &lt;SPAN class=""&gt;for&lt;/SPAN&gt; result &lt;SPAN class=""&gt;in&lt;/SPAN&gt; code_results:
            &lt;SPAN class=""&gt;if&lt;/SPAN&gt; &lt;SPAN class=""&gt;hasattr&lt;/SPAN&gt;(result, &lt;SPAN class=""&gt;'png'&lt;/SPAN&gt;):
                png_data = base64.b64decode(result.png)
                image = Image.&lt;SPAN class=""&gt;open&lt;/SPAN&gt;(BytesIO(png_data))
                st.image(image)
            &lt;SPAN class=""&gt;elif&lt;/SPAN&gt; &lt;SPAN class=""&gt;hasattr&lt;/SPAN&gt;(result, &lt;SPAN class=""&gt;'figure'&lt;/SPAN&gt;):
                st.pyplot(result.figure)
            &lt;SPAN class=""&gt;elif&lt;/SPAN&gt; &lt;SPAN class=""&gt;hasattr&lt;/SPAN&gt;(result, &lt;SPAN class=""&gt;'show'&lt;/SPAN&gt;):
                st.plotly_chart(result)

    &lt;SPAN class=""&gt;try&lt;/SPAN&gt;:
        code_interpreter_results = code_interpret(
            e2b_code_interpreter, 
            python_code
        )
    &lt;SPAN class=""&gt;except&lt;/SPAN&gt; Exception &lt;SPAN class=""&gt;as&lt;/SPAN&gt; error:
        st.error(&lt;SPAN class=""&gt;f"Error executing code: {error}"&lt;/SPAN&gt;)
        &lt;SPAN class=""&gt;return&lt;/SPAN&gt; &lt;SPAN class=""&gt;None&lt;/SPAN&gt;

&lt;SPAN class=""&gt;if&lt;/SPAN&gt; __name__ == &lt;SPAN class=""&gt;"__main__"&lt;/SPAN&gt;:
    main()&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Step 3: Running the Application&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once the code is in place, you can launch the application from your terminal.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Open your terminal&lt;/STRONG&gt; and make sure you are in the project directory (starter_ai_agents/ai_data_visualisation_agent).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Run the Streamlit command:&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;Bash&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;streamlit run ai_data_visualisation_agent.py&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;Streamlit will start a local web server and open the application in your default web browser. The URL is typically &lt;A href="http://localhost:8501" target="_blank" rel="noopener"&gt;http://localhost:8501&lt;/A&gt;.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;HR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;H3&gt;&lt;STRONG&gt;Step 4: Using the Application&lt;/STRONG&gt;&lt;/H3&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Enter your API Keys:&lt;/STRONG&gt; In the sidebar of the Streamlit application, enter your API keys for Together AI and E2B.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Upload a CSV file:&lt;/STRONG&gt; Use the file uploader to select a CSV dataset from your computer.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Ask a question:&lt;/STRONG&gt; Type a natural language query in the text area, such as "Show me a bar chart of sales by product category" or "What is the correlation between price and quantity?".&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Click "Analyze":&lt;/STRONG&gt; The agent will process your request, generate and execute the Python code, and display the resulting visualization directly in the application.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This process provides a comprehensive solution for creating an AI agent that can generate and display data visualizations, offering a powerful tool for data exploration and analysis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Aug 2025 09:15:00 GMT</pubDate>
      <guid>https://community.databricks.com/t5/generative-ai/displaying-plots-in-custom-ai-agents/m-p/127302#M1076</guid>
      <dc:creator>Khaja_Zaffer</dc:creator>
      <dc:date>2025-08-04T09:15:00Z</dc:date>
    </item>
  </channel>
</rss>

