This guide assumes you have basic knowledge of Python, Streamlit, and Autogen.
You’ll also need a Thesys API key from the C1 Console.
View the code
Find more examples and complete code on our GitHub repository.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Documentation MCP is live. Click here to integrate into your IDE (Cursor, VSCode, Claude)
Give your Autogen agents interactive UI components and dynamic workflows powered by Thesys C1
Install dependencies
pip install -U "autogen-agentchat" "autogen-ext[openai]" "streamlit" "streamlit-thesys"
Configure Thesys model client
import asyncio
import os
import streamlit as st
import streamlit_thesys as thesys
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_core.models import ModelInfo
model_client = OpenAIChatCompletionClient(
base_url="https://api.thesys.dev/v1/embed",
api_key=os.getenv("THESYS_API_KEY"),
model="c1/anthropic/claude-sonnet-4/v-20250815",
model_info=ModelInfo(
vision=False,
function_calling=True,
json_output=False,
family="unknown",
structured_output=True,
),
)
Create agent with tools
# Define a simple function tool
async def get_weather(city: str) -> str:
"""Get the weather for a given city."""
return f"The weather in {city} is 73 degrees and Sunny."
# Create the agent
agent = AssistantAgent(
name="weather_agent",
model_client=model_client,
tools=[get_weather],
system_message="You are a helpful assistant.",
reflect_on_tool_use=True,
model_client_stream=True,
)
Build Streamlit interface
async def main() -> None:
st.title("Autogen Generative UI Chat")
task = st.text_input("Enter a task:", value="What is the weather in New York?")
if st.button("Run"):
with st.spinner("Running..."):
result = await agent.run(task=task)
if result.messages:
final_message = result.messages[-1]
thesys.render_response(final_message.content)
await model_client.close()
if __name__ == "__main__":
asyncio.run(main())
Was this page helpful?