Skip to main content
Version: v4.0.5 [Denim]

Lab 3: Integrating a Task-Specific Agent in MX-AI

In this lab, you will integrate a task-specific agent into the MX-AI ecosystem. Once deployed, the agent will collaborate with the supervisor agent and handle user requests through the UI.

Containerizing the Agent

To deploy your SLA Agent in MX-AI, you must containerize it so it can run inside Kubernetes and be managed by the platform.

In order to get a lightweight image, we recommend containerizing your agent using pyinstaller to create a standalone executable. To do this, you need to add the following spec file to the root of your project (at the same level of __main__.py).

agent.spec

# -*- mode: python ; coding: utf-8 -*-

a = Analysis(
['__main__.py'],
pathex=['.'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='sla-agent',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)

Below is a reference Dockerfile suitable for containerizing the agent.

Dockerfile

FROM ghcr.io/astral-sh/uv:python3.13-bookworm AS base
FROM debian:bookworm-slim AS runtime

# Stage 1: Builder
FROM base AS builder

# Install objdump
RUN apt-get update && \
apt-get install -y --no-install-recommends \
binutils

# Copy app files
WORKDIR /app
COPY . .

# Install dependencies
RUN uv lock
RUN uv sync --locked

# Build and strip the binary
RUN uv add pyinstaller
RUN uv run pyinstaller agent.spec
RUN strip dist/sla-agent

# Stage 2: Runtime
FROM runtime

# Copy built binary
COPY --from=builder /app/dist/sla-agent /app/
COPY --from=builder /app/agent.json /app/
COPY --from=builder /app/config.yaml /app/

# Entrypoint
WORKDIR /app
ENTRYPOINT ["./sla-agent"]

Build and Push the Image

You can simplify image management with the following Makefile.

Makefile

# Set your Docker registry here
DOCKER_REGISTRY ?= hub.example.com

REPO ?= agents/sla-agent
VERSION ?= $(shell git describe --tags --always --abbrev --dirty)
IMAGE_TAG := $(DOCKER_REGISTRY)/$(REPO):$(VERSION)

.PHONY: build run push clean

build:
@echo "Building Agent Docker image with tag: $(IMAGE_TAG) - Version: $(VERSION)"
docker build $(if $(NO_CACHE),--no-cache) \
--build-arg VERSION=$(VERSION) \
--tag $(IMAGE_TAG) .
@echo "Agent Docker image built successfully."

run:
docker run --rm \
-it \
--env-file .env \
--network host \
$(IMAGE_TAG)

push:
@echo "Pushing Agent Docker image with tag: $(IMAGE_TAG)"
docker push $(IMAGE_TAG)
@echo "Agent Docker image pushed successfully."

clean:
docker rmi $(IMAGE_TAG) || true

Build the image:

make build

Run it locally:

make run

Push it to your registry:

make push

Note

In case you don't have a registry to push your agent, we are providing an image for the SLA Agent on our registry at hub.bubbleran.com/orama/agents/sla-agent:2026_04. You can use this image in the next steps to integrate it into the AI Fabric.

Integration with other agents

After pushing the image, you can deploy the agent using an AIFabric, as introduced in Lab 1.

The example below deploys adds the custom SLA Agent to the AI Fabric deployed in the first lab.

slafabric.yaml

apiVersion: odin.trirematics.io/v1
kind: AIFabric
metadata:
name: slafabric
namespace: trirematics
spec:
ui: hub.bubbleran.com/orama/ui/iris
mcp:
- name: observability-db
image: hub.bubbleran.com/orama/mcp/observability-db
smoAccess:
- read
llms:
- name: openai-model
provider: openai
model: gpt-4.1-mini
apiKey: <YOUR-API-KEY>
topology: supervised
agents:
- name: supervisor-agent
role: supervisor
image: hub.bubbleran.com/orama/agents/supervisor-v2
llm: openai-model
icp: a2a
- name: smo-agent
role: worker
image: hub.bubbleran.com/orama/agents/smo-agent
llm: openai-model
smoAccess:
- read
- write
mcpServers:
- observability-db
icp: a2a
- name: sla-agent
image: hub.bubbleran.com/orama/agents/sla-agent
llm: openai-model
role: worker
smoAccess:
- read
ricAccess:
- read
- write
icp: a2a
env:
# set this value based on your requirements
- name: HIGH_THROUGHPUT_GUA
value: "150000" # kbps
# set this value based on your requirements
- name: LOW_THROUGHPUT_GUA
value: "70000" # kbps

Deploy the AIFabric:

brc install aifabric slafabric.yaml

Before testing the agents, let's deploy a network in which we can enforce SLA policies. You can use the following template to deploy a sample OAI network called bubbleran with an RF-sim UE called ue1.

network.yaml

apiVersion: athena.trirematics.io/v1
kind: Network
metadata:
name: bubbleran
namespace: trirematics
spec:
slices:
- plmn: "00101"
dnn: "internet"
network-mode: "IPv4"
service-type: 1
differentiator: 0x000000
ipv4-range: "12.1.1.0/24"
ipv6-range: "2001:db8:1::/64"
access:
- name: oai-gnb
stack: 5g-sa
model: oai-ran/monolithic-gnb
identity:
an-id: 50
radio:
device: rf-sim
cells:
- band: n78
arfcn: 641280
bandwidth: 40MHz
subcarrier-spacing: 30kHz
tdd-config:
period: 5000
dl-slots: 7
dl-symbols: 6
ul-slots: 2
ul-symbols: 4
controller: flexric.bubbleran
core-networks:
- minimal.bubbleran
core:
- name: minimal
stack: 5g-sa
model: oai-cn/minimal
identity:
region: 0
cn-group: 4
cn-id: 5
dns:
ipv4:
default: 8.8.8.8
secondary: 8.8.4.4
edge:
- name: flexric
stack: 5g-sa
model: mosaic5g/flexric
- name: sdl
stack: 5g-sa
model: mosaic5g/xapps-sdl
---
apiVersion: athena.trirematics.io/v1
kind: Terminal
metadata:
name: ue1
namespace: trirematics
spec:
vendor: oai
stack: 5g-sa
model: terminal/nr-rfsim
preferred-access: oai-gnb.bubbleran
target-cores:
- minimal.bubbleran
identity:
imsi: "001010000000001"
pin: "1234"
opc: "0xc42449363bbad02b66d16bc975d77cc1"
key: "0xfec86ba6eb707ed08905757b1bb44b8f"
sqn: "0xff9bb4000001"
slice:
dnn: "internet"
network-mode: "IPv4"
service-type: 1
differentiator: 0x000000
radio:
bands:
- n78
readiness-check:
method: ping
target: google-ip
interface-name: oaitun_ue0

At this point, you can interact with the agents through the UI in the same way as in Lab 1. The supervisor agent will delegate relevant requests to the SLA Agent, which will handle them based on its defined logic.

Example workflow

  1. Ask the supervisor agent what is the name of the deployed network.
  2. The agent should reply that there is a network called bubbleran.
  3. Ask the supervisor agent to enforce an SLA policy to allow you to download large files and watch 4K youtube streaming.
  4. The agent should delegate this query to the SLA Agent who will apply the necessary policy.
  5. You should be able to see a PolicyJob called agentpolicy in the cluster. You can also run the brc test throughput command to verify that the policy has been enforced correctly.

Note

With future updates, you will be able to push your agents directly to the BubbleRAN registry to share them with the community.

What You Learned

  • How to containerize a task-specific agent
  • How to publish it to a container registry
  • How to integrate it into an AIFabric
  • How custom agents collaborate with the supervisor agent in MX-AI