Skip to content

Langflow Setup for Agentic VLAN Management

Environment

The Langflow experiments use the same NetBox-based VLAN test scenario used in the GP4L agentic workflow work. Langflow runs as the workflow platform, NetBox acts as the source of truth, and the LLM is accessed through an OpenAI-compatible endpoint.

Service Address Role
NetBox http://host.docker.internal:8000 Network inventory and source of truth
NetBox MCP server http://host.docker.internal:8888/mcp Read-only NetBox tool exposure, used by the plain orchestrator
Langflow http://localhost:7860 Visual workflow platform
OpenWebUI https://your-host/openai/v1 OpenAI-compatible LLM endpoint

Langflow runs in Docker Compose together with a Postgres database used for flow and session storage.

Connecting the LLM

Langflow's built-in provider configuration validates API keys against the official provider endpoints. This can make it difficult to configure a self-hosted or non-standard OpenAI-compatible endpoint through the UI.

The reliable approach is to configure the OpenAI-compatible endpoint through Docker environment variables:

environment:
  - OPENAI_API_KEY=<your-api-key>
  - OPENAI_BASE_URL=https://your-openwebui-host/openai/v1
  - PYTHONHTTPSVERIFY=0

With these variables set, Langflow's OpenAI provider routes calls to the configured OpenWebUI endpoint.

The experiments used Qwen2.5:72b through OpenWebUI. The model name must match the model name exposed by the endpoint.

Langflow Bug: MCP Filters Silently Dropped

A Langflow MCP issue was encountered during the plain orchestrator implementation. When using the NetBox MCP tool, free-form dictionary arguments such as filters were silently dropped. As a result, MCP calls that were expected to return filtered NetBox objects returned unfiltered results instead.

This affected the plain orchestrator, which used the MCP netbox_get_objects tool for NetBox reads. The guarded orchestrator avoids this issue by not using MCP for NetBox lookups. Instead, all NetBox reads are performed directly inside the lookup_and_guard Python tool through REST API calls.

If the plain orchestrator is used, the Langflow MCP filtering issue must be patched in the running container. The guarded orchestrator is not affected.

Flow Files

The Langflow flow files are generated from Python build scripts rather than edited manually. This makes the implementation easier to maintain, because exported Langflow JSON files are large and difficult to review directly.

Repository with Python build scripts and flow files:

Flow Build script Output
Guarded Orchestrator flows/build_guarded_orchestrator.py flows/vlan_guarded_orchestrator_v1.json
Plain Orchestrator flows/build_orchestrator.py flows/vlan_orchestrator_v2.json

The guarded orchestrator is the recommended implementation.

Rebuilding the Flows

After changing component code, prompts, model configuration, or tool definitions, rebuild the selected flow:

cd flows/
python build_guarded_orchestrator.py

Then delete the existing flow in Langflow and import the generated JSON file again.

This approach avoids manual UI changes after every modification and keeps the flow reproducible.

LLM Quirk: List Arguments Serialised as Strings

During testing, Qwen2.5:72b sometimes serialised list arguments as JSON strings when calling structured tools. For example, instead of passing:

[2, 3]

the model passed:

"[2, 3]"

To make the tools robust, all custom components that accept list arguments defensively parse stringified lists before using them:

if isinstance(tagged_vlans, str):
    tagged_vlans = json.loads(tagged_vlans)

tagged_vlans = [int(v) for v in tagged_vlans]

This is applied to the PATCH and rollback tools.