DEV Community

shashank ms
shashank ms

Posted on

Agentic Workload Tutorial: Getting Started with Oxlo

We are going to build a support ticket triage agent that reads raw customer messages, classifies urgency, extracts key facts, and drafts a first reply. This gives small teams a structured first touch so human agents spend time on the tickets that actually need them. Because Oxlo.ai charges a flat rate per request rather than per token, running this on long, messy customer emails does not inflate costs.

What you'll need

Step 1: Configure the Oxlo.ai client

I import the SDK and point it at Oxlo.ai's OpenAI-compatible endpoint. I pick qwen-3-32b because Oxlo.ai lists it for agent workflows, and because there are no cold starts on popular models the agent responds immediately. The flat per-request pricing also means long system prompts do not inflate cost.

from openai import OpenAI
import json

client = OpenAI(base_url="https://api.oxlo.ai/v1", api_key="YOUR_OXLO_API_KEY")
MODEL = "qwen-3-32b"

Step 2: Define the system prompt

The system prompt is the agent's contract. It defines the output schema and tone so the model behaves like a deterministic pipeline stage rather than a chatbot.

SYSTEM_PROMPT = """You are a support triage agent. For every ticket you must:
1. Classify priority: low, medium, high, or critical.
2. Extract product_area, customer_sentiment, and core_issue (max 10 words each).
3. Draft a brief, empathetic first response.

Output strictly as JSON with keys: priority, product_area, customer_sentiment, core_issue, draft_response.
Do not wrap the output in markdown code fences."""

Step 3: Enforce JSON output

Oxlo.ai supports JSON mode, so we can request a valid object directly and parse it with standard library calls. This removes regex hacks and makes the agent reliable.

def triage_ticket(ticket_text: str) -> dict:
    response = client.chat.completions.create(
        model=MODEL,
        messages=[
            {"role": "system", "content": SYSTEM_PROMPT},
            {"role": "user", "content": ticket_text},
        ],
        response_format={"type": "json_object"},
    )
    raw = response.choices[0].message.content
    return json.loads(raw)

Step 4: Add escalation logic

Parsing is only half the job. The agent needs to act on the parsed data. This wrapper applies simple business rules and appends the next action so a human knows exactly what to do.

def handle_ticket(ticket_text: str) -> dict:
    result = triage_ticket(ticket_text)

    if result["priority"] == "critical":
        result["action"] = "ALERT: Escalate to on-call engineer immediately."
    elif result["priority"] == "high":
        result["action"] = "Queue for senior agent within 1 hour."
    else:
        result["action"] = "Add to standard queue."

    return result

Step 5: Batch process tickets

In practice, tickets arrive as a stream or a list. This loop feeds each one through the pipeline and prints structured results. With Oxlo.ai, each ticket is one flat request, so the cost stays predictable even when customers write novels.

tickets = [
    "I cannot log in. I have a demo in 10 minutes and the SSO page throws a 500 error. This is blocking our entire sales team.",
    "Would be nice to have dark mode in the dashboard. Not urgent, just a thought.",
]

for t in tickets:
    out = handle_ticket(t)
    print(json.dumps(out, indent=2))
    print("-" * 40)

Run it

Save the script as triage_agent.py, replace YOUR_OXLO_API_KEY, and run python triage_agent.py. You should see output similar to this.

{
  "priority": "critical",
  "product_area": "SSO authentication",
  "customer_sentiment": "frustrated",
  "core_issue": "SSO page returns 500 error",
  "draft_response": "I am sorry you are hitting this right before a demo. I am escalating this to our on-call engineer immediately and will update you within 15 minutes.",
  "action": "ALERT: Escalate to on-call engineer immediately."
}
----------------------------------------
{
  "priority": "low",
  "product_area": "UI dashboard",
  "customer_sentiment": "neutral",
  "core_issue": "Request for dark mode",
  "draft_response": "Thanks for the suggestion. I have logged this in our feature backlog and will share it with the product team.",
  "action": "Add to standard queue."
}
----------------------------------------

Next steps

Add real tool calls. Oxlo.ai supports function calling, so you can give the agent real tools like create_jira_issue or send_slack_alert instead of just printing actions.

Route complex tickets to a reasoning model. Swap qwen-3-32b for deepseek-r1-671b or kimi-k2.6 when the core issue involves multi-step debugging, and keep the fast model for simple triage.

Top comments (0)