✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: December 28, 2025
  • 7 min read

How to Build Production‑Grade Agentic Workflows with GraphBit – A Step‑by‑Step Guide



Production‑Grade Agentic Workflows with GraphBit: A Step‑by‑Step Tutorial

Answer: GraphBit lets AI developers, data engineers, and tech entrepreneurs build production‑grade agentic workflows that combine deterministic, offline‑executable tools with optional LLM orchestration, delivering reproducible, scalable AI pipelines for real‑world use cases.


GraphBit workflow illustration

Why GraphBit Matters in Modern AI Automation

In the era of AI automation, organizations demand pipelines that are both deterministic (for compliance and testing) and agentic (to leverage large language models when needed). GraphBit, the core execution engine behind the Enterprise AI platform by UBOS, bridges this gap by providing a graph‑structured runtime where each node can be a pure function, a tool, or an LLM‑driven agent. The result is a single, version‑controlled workflow that can run offline today and be upgraded to full LLM orchestration tomorrow—without rewriting business logic.

GraphBit at a Glance

GraphBit is an open‑source, Python‑first library that treats workflow definitions as directed acyclic graphs (DAGs). Its key capabilities include:

  • Explicit runtime configuration (thread pools, memory limits, tracing).
  • First‑class tool registration with type‑safe signatures.
  • Built‑in validation of node contracts (JSON schemas, strict typing).
  • Seamless switch between offline deterministic mode and online LLM mode.

The engine is deliberately agnostic: it can call any Python function, any REST API, or any LLM provider (OpenAI, Anthropic, DeepSeek, Mistral). This makes GraphBit a perfect fit for the AI automation strategies promoted across UBOS solutions.

1️⃣ Runtime Setup – Getting the Engine Ready

Before any workflow can execute, the GraphBit runtime must be initialized with resource constraints that match your production environment. Below is a concise checklist that you can copy‑paste into a notebook or CI pipeline:

pip install graphbit rich pydantic numpy
from graphbit import configure_runtime, init, get_system_info, health_check

configure_runtime(worker_threads=4, max_blocking_threads=8, thread_stack_size_mb=2)
init(log_level="warn", enable_tracing=False)

info = get_system_info()
health = health_check()
print(info, health)

The configure_runtime call lets you control threading and stack size, which is crucial for cloud‑native deployments where CPU quotas are strict. After initialization, a quick health_check() confirms that the runtime is ready, mirroring the health‑probe pattern used in Kubernetes.

For a deeper dive into runtime tuning, explore the UBOS platform overview, which explains how GraphBit integrates with UBOS’s container orchestration layer.

2️⃣ Data Modeling – Defining the Domain Objects

A robust workflow starts with a clear data model. In the tutorial, a Ticket dataclass represents a customer‑support request. Using UBOS templates for quick start, you can generate similar Pydantic models for any domain (e.g., order processing, IoT telemetry, or HR onboarding).

from dataclasses import dataclass
from typing import List
import time, random

@dataclass
class Ticket:
    ticket_id: str
    user_id: str
    text: str
    created_at: float

def make_tickets(n: int = 10) -> List[Ticket]:
    seeds = [...]
    # (omitted for brevity)
    return tickets

The model is deliberately typed so that downstream tools can rely on static validation, reducing runtime errors—a best practice for production AI pipelines.

3️⃣ Deterministic Tool Registration – Building Reproducible Business Logic

GraphBit’s @tool decorator registers pure Python functions as first‑class workflow nodes. In the tutorial three deterministic tools are created:

  • classify_ticket – maps free‑text to a coarse category and priority.
  • route_ticket – selects a queue and SLA based on the category.
  • draft_response – generates a templated reply using the category and priority.

Because these tools contain no LLM calls, they are fully testable with unit tests and can be executed in isolated environments (e.g., CI pipelines). The AI marketing agents page showcases a similar pattern where deterministic content‑generation tools are combined with LLMs for final copy polishing.

4️⃣ Offline Pipeline Execution – From Tickets to Structured Outputs

Once tools are registered, they can be composed into a deterministic pipeline. The tutorial defines an offline_triage function that runs the three tools sequentially and returns a rich JSON payload. Below is a simplified version:

def offline_triage(ticket: Ticket) -> dict:
    c = classify_ticket(ticket.text)
    r = route_ticket(c["category"], c["priority"])
    d = draft_response(c["category"], c["priority"], ticket.text)
    return {
        "ticket_id": ticket.ticket_id,
        "category": c["category"],
        "priority": c["priority"],
        "queue": r["queue"],
        "sla_hours": r["sla_hours"],
        "draft": d["message"],
    }

Running this function over a batch of tickets produces a table of results that can be visualized directly in notebooks or exported to a data lake. The Workflow automation studio provides a UI to monitor such batch jobs, set alerts on SLA breaches, and trigger downstream actions (e.g., Slack notifications).

Metrics such as priority distribution and average SLA are calculated with NumPy, demonstrating how GraphBit can be a source of observability data for SRE teams.

5️⃣ Online Execution – Adding LLM Orchestration on Demand

The true power of GraphBit shines when you replace—or augment—the deterministic pipeline with LLM‑driven agents. By providing an LlmConfig (OpenAI, Anthropic, DeepSeek, or Mistral), the same workflow graph can invoke a language model to enrich the response, perform sentiment analysis, or even rewrite the draft in a brand‑specific tone.

def pick_llm_config():
    if os.getenv("OPENAI_API_KEY"):
        return LlmConfig.openai(os.getenv("OPENAI_API_KEY"), "gpt-4o-mini")
    # other providers omitted for brevity
    return None

When pick_llm_config() returns a valid configuration, the Executor runs the workflow in online mode. The tutorial shows a single‑ticket run that measures execution time and returns the full variable set, proving that the transition from offline to online is a single‑line change.

For developers who want to experiment with LLM‑enhanced agents without leaving the UBOS ecosystem, the OpenAI ChatGPT integration page offers ready‑made connectors, API‑key management, and usage dashboards.

6️⃣ Sample Results & Business Benefits

Below is a snapshot of the JSON output from an online run (truncated for brevity):

{
  "mode": "online",
  "execution_time_ms": 312,
  "variables": {
    "ticket_id": "T-1001",
    "category": "billing",
    "priority": "p2",
    "queue": "billing_support",
    "sla_hours": 24,
    "customer_message": "We can help with billing. Please confirm the last 4 digits..."
  }
}

The tangible benefits for enterprises are:

  • Reproducibility: The same code runs offline for testing and online for production.
  • Scalability: Graph‑based execution enables parallelism across independent nodes.
  • Compliance: Deterministic tools guarantee auditability; LLM calls are optional and can be logged.
  • Speed‑to‑value: Teams can start with pure Python logic and later add LLMs without refactoring.

Real‑world case studies are highlighted in the UBOS portfolio examples, where fintech firms reduced ticket‑handling time by 40% after migrating to a GraphBit‑powered pipeline.

Conclusion – Your Next Steps with GraphBit

Building production‑grade agentic workflows no longer requires a choice between “pure code” and “LLM magic.” GraphBit gives you a unified substrate where deterministic tools provide the foundation and LLM agents add intelligence on demand. By following the six steps outlined above—runtime setup, data modeling, tool registration, offline execution, optional LLM orchestration, and results analysis—you can deliver AI‑driven automation that is both trustworthy and future‑proof.

Ready to try it yourself? Visit the UBOS homepage to spin up a free sandbox, explore the GraphBit overview, and join the UBOS partner program for dedicated support and co‑marketing opportunities.

For the original in‑depth tutorial, see the article on MarkTechPost: How to Build Production‑Grade Agentic Workflows with GraphBit.


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.