- Updated: March 23, 2026
- 8 min read
Building an End‑to‑End Business Workflow with OpenClaw Agents
Answer: You can build a fully automated end‑to‑end business workflow on UBOS by chaining three OpenClaw agents—Sales Lead Capture, Support Ticket Triage, and DevOps Provisioning—using the built‑in Workflow automation studio. Each agent runs in its own container, communicates through UBOS’s event bus, and can be self‑hosted with the OpenClaw self‑hosting guide.
1. Introduction
Modern SaaS businesses need to capture leads, triage support tickets, and provision infrastructure without manual hand‑offs. UBOS provides a unified platform overview that lets developers spin up AI agents, connect them with low‑code Web app editor, and orchestrate complex flows with the Workflow automation studio. This guide walks you through building a complete business workflow using OpenClaw agents on UBOS.
By the end of this tutorial you will have:
- A sales lead capture agent that enriches inbound leads.
- A support ticket triage agent that routes tickets to the right team.
- A DevOps provisioning agent that creates cloud resources on demand.
- An orchestrated pipeline that ties the three agents together.
- Instructions for self‑hosting the solution on your own UBOS instance.
2. Overview of OpenClaw agents and collaboration pattern
OpenClaw is UBOS’s open‑source framework for building autonomous AI agents. Each agent is a Docker‑compatible microservice that exposes a JSON‑based invoke endpoint. Agents communicate via UBOS’s event bus, which guarantees at‑least‑once delivery and automatic retries.
Collaboration pattern
- Trigger → Lead Capture: A webhook from a marketing form posts a JSON payload to the Lead Capture agent.
- Lead Capture → Enrichment: The agent enriches the lead using an external CRM API and emits a
lead.enrichedevent. - Enriched Lead → Ticket Triage: The Support Ticket Triage agent listens for
lead.enriched, creates a ticket, and classifies its priority. - Ticket Triage → Provisioning: If the ticket is a “new‑customer onboarding” type, the DevOps Provisioning agent receives a
ticket.provisionevent and spins up the required cloud resources. - Completion → Notification: A final
workflow.completedevent notifies the sales team via Slack.
This pattern follows the MECE principle: each agent has a single responsibility, and the event flow is mutually exclusive and collectively exhaustive.
3. Sales lead capture agent – description and code snippet
The Lead Capture agent receives raw lead data, validates fields, enriches the record with OpenAI ChatGPT integration for sentiment analysis, and publishes a lead.enriched event.
import os
import json
import requests
from flask import Flask, request, jsonify
app = Flask(__name__)
CHATGPT_ENDPOINT = os.getenv("CHATGPT_ENDPOINT")
CRM_API = os.getenv("CRM_API")
EVENT_BUS_URL = os.getenv("EVENT_BUS_URL")
def enrich_with_chatgpt(text):
payload = {"model": "gpt-4o-mini", "messages": [{"role": "user", "content": text}]}
resp = requests.post(CHATGPT_ENDPOINT, json=payload)
resp.raise_for_status()
return resp.json()["choices"][0]["message"]["content"]
@app.route("/invoke", methods=["POST"])
def invoke():
lead = request.json
# Basic validation
required = ["name", "email", "message"]
if not all(k in lead for k in required):
return jsonify({"error": "Missing required fields"}), 400
# Sentiment analysis via ChatGPT
sentiment = enrich_with_chatgpt(f"Analyze sentiment of: {lead['message']}")
lead["sentiment"] = sentiment
# Push to CRM
crm_resp = requests.post(CRM_API, json=lead)
crm_resp.raise_for_status()
# Emit event
event = {"type": "lead.enriched", "payload": lead}
requests.post(EVENT_BUS_URL, json=event)
return jsonify({"status": "lead captured and enriched"}), 200
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)Deploy the agent with a single UBOS command:
ubos deploy lead-capture --path ./lead-capture-agentFor a ready‑made template, see the AI Article Copywriter which demonstrates similar API handling.
4. Support ticket triage agent – description and code snippet
The Ticket Triage agent subscribes to lead.enriched events, creates a ticket in your help‑desk system, and classifies its urgency using the Chroma DB integration for vector similarity.
import os
import json
import requests
from flask import Flask, request, jsonify
from chromadb import Client as ChromaClient
app = Flask(__name__)
HELPDESK_API = os.getenv("HELPDESK_API")
CHROMA_URL = os.getenv("CHROMA_URL")
EVENT_BUS_URL = os.getenv("EVENT_BUS_URL")
chroma = ChromaClient(host=CHROMA_URL)
def classify_priority(message):
# Use Chroma DB to find similar high‑priority tickets
results = chroma.query(
collection_name="tickets",
query_texts=[message],
n_results=3
)
# Simple heuristic: if any similar ticket is "high", mark as high
for r in results["distances"][0]:
if r < 0.2: # similarity threshold
return "high"
return "normal"
@app.route("/event", methods=["POST"])
def handle_event():
event = request.json
if event["type"] != "lead.enriched":
return jsonify({"status": "ignored"}), 200
lead = event["payload"]
priority = classify_priority(lead["message"])
ticket = {
"title": f"New lead from {lead['name']}",
"description": lead["message"],
"priority": priority,
"contact": {"email": lead["email"]},
"tags": ["lead", "auto‑generated"]
}
# Create ticket
resp = requests.post(HELPDESK_API, json=ticket)
resp.raise_for_status()
ticket_id = resp.json()["id"]
# Emit next event if provisioning is needed
if "new‑customer onboarding" in lead.get("tags", []):
next_event = {"type": "ticket.provision", "payload": {"ticket_id": ticket_id, "lead": lead}}
requests.post(EVENT_BUS_URL, json=next_event)
return jsonify({"status": "ticket created", "ticket_id": ticket_id}), 200
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8081)Deploy with:
ubos deploy ticket-triage --path ./ticket-triage-agentNeed a quick start? Check the UBOS templates for quick start that include a pre‑configured ticketing flow.
5. DevOps provisioning agent – description and code snippet
The Provisioning agent listens for ticket.provision events and uses the ChatGPT and Telegram integration to send real‑time status updates to the ops team. It then calls your cloud provider’s API (AWS, GCP, Azure) to spin up a sandbox environment.
import os
import json
import requests
from flask import Flask, request, jsonify
app = Flask(__name__)
CLOUD_API = os.getenv("CLOUD_API")
TELEGRAM_BOT = os.getenv("TELEGRAM_BOT")
EVENT_BUS_URL = os.getenv("EVENT_BUS_URL")
def notify_telegram(message):
payload = {"chat_id": os.getenv("TELEGRAM_CHAT_ID"), "text": message}
requests.post(TELEGRAM_BOT, json=payload)
@app.route("/event", methods=["POST"])
def handle_event():
event = request.json
if event["type"] != "ticket.provision":
return jsonify({"status": "ignored"}), 200
data = event["payload"]
lead = data["lead"]
ticket_id = data["ticket_id"]
notify_telegram(f"🚀 Starting provisioning for ticket {ticket_id} (lead: {lead['email']})")
# Example payload for cloud provisioning
provision_payload = {
"name": f"{lead['name']}-sandbox",
"region": "us-east-1",
"resources": {"cpu": 2, "memory_gb": 4}
}
resp = requests.post(CLOUD_API, json=provision_payload)
resp.raise_for_status()
env_url = resp.json()["dashboard_url"]
notify_telegram(f"✅ Provisioning complete! Access the sandbox at {env_url}")
# Emit final event
final_event = {"type": "workflow.completed", "payload": {"ticket_id": ticket_id, "env_url": env_url}}
requests.post(EVENT_BUS_URL, json=final_event)
return jsonify({"status": "provisioned", "env_url": env_url}), 200
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8082)Deploy with:
ubos deploy devops-provisioner --path ./devops-provisioner-agentFor a visual example of provisioning, see the UBOS portfolio examples.
6. End‑to‑end workflow orchestration
With the three agents deployed, use the Workflow automation studio to define the event routing graph. The following JSON snippet can be imported directly into the studio:
{
"nodes": [
{"id": "lead-capture", "type": "agent", "endpoint": "http://lead-capture:8080/invoke"},
{"id": "ticket-triage", "type": "agent", "endpoint": "http://ticket-triage:8081/event"},
{"id": "devops-provisioner", "type": "agent", "endpoint": "http://devops-provisioner:8082/event"}
],
"edges": [
{"source": "lead-capture", "event": "lead.enriched", "target": "ticket-triage"},
{"source": "ticket-triage", "event": "ticket.provision", "target": "devops-provisioner"},
{"source": "devops-provisioner", "event": "workflow.completed", "target": "notification-service"}
]
}The studio automatically creates the necessary subscriptions on the event bus, so no additional code is required. You can monitor the flow in real time via the UBOS partner program dashboard, which offers built‑in metrics and alerting.
Testing the pipeline
- Send a test webhook to the Lead Capture endpoint (use
curlor Postman). - Observe the ticket creation in your help‑desk UI.
- Watch the provisioning logs in the DevOps console.
- Confirm the final Slack/Telegram notification.
7. Self‑hosting with UBOS – internal link
While UBOS Cloud offers a managed environment, many enterprises prefer to host the stack on‑premise for compliance reasons. Follow the step‑by‑step OpenClaw self‑hosting guide to install UBOS on a Kubernetes cluster, configure persistent volumes for the event bus, and expose the agents behind an internal ingress.
Key self‑hosting steps:
- Provision a 3‑node K8s cluster (minimum 8 vCPU, 16 GB RAM each).
- Run
ubos installto bootstrap the platform. - Deploy the three agents using the
ubos deploycommands shown earlier. - Secure the event bus with TLS certificates (UBOS auto‑generates them).
For cost planning, review the UBOS pricing plans which include a free tier for up to 5 agents.
8. Conclusion and next steps
You now have a production‑ready, end‑to‑end business workflow powered by OpenClaw agents on UBOS. The modular design lets you replace any component—swap the CRM, change the ticketing system, or adopt a different cloud provider—without touching the other agents.
Next steps you might consider:
- Integrate ElevenLabs AI voice integration to add spoken status updates.
- Leverage the AI marketing agents to auto‑generate follow‑up emails.
- Explore the Enterprise AI platform by UBOS for scaling to thousands of concurrent workflows.
For a deeper dive into building custom agents, check out the About UBOS page and the extensive UBOS portfolio examples. Happy automating!
This guide builds upon the original announcement of OpenClaw and expands it with a developer‑focused workflow.