We are going to build a lightweight customer support agent that reads a message, classifies the issue, and drafts a first response. This is a practical first LLM project that teaches system prompts, model selection, and API calls without unnecessary complexity. I use Oxlo.ai because its flat per-request pricing and OpenAI-compatible API make it easy to experiment without worrying about token math.
What you'll need
- An Oxlo.ai API key from https://portal.oxlo.ai
- Python 3.10 or newer
- The OpenAI SDK:
pip install openai
Step 1: Initialize the Oxlo.ai client
Before sending prompts, point the OpenAI SDK at the Oxlo.ai endpoint and authenticate. The client setup is a drop-in replacement.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Say hello"},
],
)
print(response.choices[0].message.content)
Step 2: Write the agent's system prompt
The system prompt is the agent's job description. It tells the model who it is, what format to use, and what rules to follow.
SYSTEM_PROMPT = """You are a Tier-1 Support Agent for a SaaS company.
Your task is to:
1. Classify the customer issue into one of: Billing, Technical, Account, or General.
2. Draft a polite, concise first response.
Format your output exactly like this:
Category: <category>
Draft Reply: <reply>"""
Step 3: Build the classify and respond function
This function takes a raw customer message, sends it to Llama 3.3 70B on Oxlo.ai, and returns the structured output. I use Llama 3.3 70B because it is a strong general-purpose model for following instructions.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
SYSTEM_PROMPT = """You are a Tier-1 Support Agent for a SaaS company.
Your task is to:
1. Classify the customer issue into one of: Billing, Technical, Account, or General.
2. Draft a polite, concise first response.
Format your output exactly like this:
Category: <category>
Draft Reply: <reply>"""
def classify_and_respond(user_message: str) -> str:
response = client.chat.completions.create(
model="llama-3.3-70b",
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message},
],
)
return response.choices[0].message.content
ticket = "I was charged twice this month. Can you refund the extra payment?"
print(classify_and_respond(ticket))
Step 4: Route complex tickets to a reasoning model
Some issues need deeper analysis. Oxlo.ai offers reasoning models like Qwen 3 32B that handle ambiguous or multi-step problems well. We can add a simple router that sends long or angry messages to a stronger model.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
SYSTEM_PROMPT = """You are a Tier-1 Support Agent for a SaaS company.
Your task is to:
1. Classify the customer issue into one of: Billing, Technical, Account, or General.
2. Draft a polite, concise first response.
Format your output exactly like this:
Category: <category>
Draft Reply: <reply>"""
def route_and_respond(user_message: str) -> str:
if len(user_message) > 200 or "urgent" in user_message.lower():
model = "qwen-3-32b"
else:
model = "llama-3.3-70b"
response = client.chat.completions.create(
model=model,
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message},
],
)
return response.choices[0].message.content
complex_ticket = (
"URGENT: Our API integration stopped working after your latest update. "
"We are getting 403 errors on every request and this is blocking our checkout flow. "
"I need a workaround immediately."
)
print(route_and_respond(complex_ticket))
Step 5: Process a batch of tickets
In production, you will handle more than one ticket at a time. Here is a short loop that processes a list and prints the results.
from openai import OpenAI
client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
SYSTEM_PROMPT = """You are a Tier-1 Support Agent for a SaaS company.
Your task is to:
1. Classify the customer issue into one of: Billing, Technical, Account, or General.
2. Draft a polite, concise first response.
Format your output exactly like this:
Category: <category>
Draft Reply: <reply>"""
def route_and_respond(user_message: str) -> str:
if len(user_message) > 200 or "urgent" in user_message.lower():
model = "qwen-3-32b"
else:
model = "llama-3.3-70b"
response = client.chat.completions.create(
model=model,
messages=[
{"role": "system", "content": SYSTEM_PROMPT},
{"role": "user", "content": user_message},
],
)
return response.choices[0].message.content
tickets = [
"How do I reset my password?",
"I want to upgrade my plan but the button is greyed out.",
"You charged me $99 twice. Fix this now.",
]
for t in tickets:
print("---")
print(f"Ticket: {t}")
print(route_and_respond(t))
Run it
Save the full script as support_agent.py, replace YOUR_OXLO_API_KEY, and run python support_agent.py. You should see each ticket categorized and replied to.
$ python support_agent.py
---
Ticket: How do I reset my password?
Category: Account
Draft Reply: You can reset your password by clicking "Forgot password" on the login page. Let me know if you need further help.
---
Ticket: I want to upgrade my plan but the button is greyed out.
Category: Technical
Draft Reply: Thanks for reporting this. Please try clearing your browser cache or using an incognito window. If the issue persists, I will escalate it to engineering.
---
Ticket: You charged me $99 twice. Fix this now.
Category: Billing
Draft Reply: I apologize for the double charge. I have initiated a refund for the duplicate transaction. It should appear in 3 to 5 business days.
Wrap-up
You now have a working agent that classifies and drafts responses. Two concrete next steps are to add function calling so the agent can actually reset passwords or look up invoices, and to connect the script to a real support inbox via a webhook. If you start hitting longer contexts, remember that Oxlo.ai request-based pricing stays flat regardless of prompt length, which makes iterating on system prompts and conversation history inexpensive.
Top comments (0)