import streamlit as st from web_agent import agent # Import the agent instance from web_agent.py # Title of the app st.title("AI Agent Chat Interface") # Sidebar for user input st.sidebar.header("Input Parameters") user_input = st.sidebar.text_area("Enter your query:", "") # Main section st.header("Agent Response") if st.button("Submit"): if user_input.strip(): try: # Query the agent with the user input response = agent.run(user_input) # Use the `run` method to process the query # Extract the content from the RunResponse object if hasattr(response, "content"): st.success(response.content) else: st.error("Unexpected response format from the agent.") except Exception as e: st.error(f"An error occurred: {e}") else: st.warning("Please enter a query before submitting.")