Production Monitoring for Customer Support Chat Agents
Related concepts: Agent, Event SessionA customer support agent is a common use case for AI agents, where the agent interacts with users to provide assistance and answer questions.In this cookbook, you’ll learn how to instrument one using Voker’s Python SDK, and how to use Voker’s dashboard to trace user sessions, view metrics and identify areas for improvement.
Voker wraps the OpenAI Python SDK with no additional latency.You’re using the same parameters you’re used to, with the addition of voker_agent and voker_session to group data in Voker.
from voker.ai.provider_openai import OpenAI from dotenv import load_dotenvload_dotenv()client = OpenAI()SYSTEM_PROMPT = "You are a helpful customer support agent. Ask the user how their day is going and if they need any assistance."def run_customer_support_agent(messages: list[dict[str, str]], user_message: str) -> str: def chat(messages): return client.chat.completions.create( voker_agent="customer-support-agent", voker_session='demo-session-1', model="gpt-4.1-mini", messages=messages, ) messages.append({"role": "user", "content": user_message}) response = chat(messages) assistant_message = response.choices[0].message.content or "" messages.append({"role": "assistant", "content": assistant_message}) return assistant_messageif __name__ == "__main__": messages = [{"role": "system", "content": SYSTEM_PROMPT}] while True: user_input = input("\nEnter your message to the support agent: ") if user_input.lower() in {"exit"}: break response = run_customer_support_agent(messages, user_input) print(f"\nAssistant: {response}")
After a brief chat with your agent, head back to Voker and navigate to the ‘Sessions’ page.You will see an entry for the conversation you just had with your agent, click into it.