heidloff.net - Building is my Passion
Post
Cancel

Building agentic Applications with Langflow and MCP

Langflow is an open-source tool to build agentic applications via re-usable UI controls and Python code. This post demonstrates a simple example that introduces Langflow, its capability to invoke MCP tools and the option to be invoked as MCP tool.

For Internet of Things (IoT) scenarios Node-RED is a popular low-code programming tool for JavaScript developers to build applications by re-using predefined components and by wiring them together graphically or via simple scripts. To me Langflow seems to be a similar tool for agentic applications.

Definition of Langflow:

Langflow is a powerful tool for building and deploying AI-powered agents and workflows. It provides developers with both a visual authoring experience and a built-in API server that turns every agent into an API endpoint that can be integrated into applications built on any framework or stack. Langflow comes with batteries included and supports all major LLMs, vector databases and a growing library of AI tools.

Datastax develops Langflow and was aquired by IBM recently.

Definition of Model Context Protocol (MCP)

MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.

MCP has become the standard to invoke tools in agentic applications. MCP tools can be anything with a well-defined input and output, for example tools can be agentic applications.

Let’s look at a simple example.

Agent using watsonx.ai

The example uses a Large Language Model from watsonx.ai. Since watsonx.ai doesn’t show up in the ‘Agent’ component, a second ‘IBM watsonx.ai’ component is added and wired to the agent component. Enter the watsonx.ai API key and project id and choose a model.

image

Define the following instruction:

1
2
3
4
5
6
7
8
You are a helpful assistant who can use tools to answer questions and perform tasks. 

Always follow these steps:
1. Go search news about user request topic. Use the news search tool only once.
2. Process it in any way requested by the user
3. Generate the chart

Show plots as markdown.

Tool Mode

For components ‘Tool Mode’ can be turned on, so that they can be utilized by agents as tools.

image

Scenario

In the example scenario users can provide input like “retrieve apple inc news articles, extract the sentiment and then create a pie chart”. As result two tools are invoked to generate a pie chart.

  1. News Search
  2. Generate Pie Chart

image

MCP Client

The ‘Generate Pie Chart’ tool is provided via MCP. Define the following command in the ‘MCP Connection’ component.

1
npx -y @antv/mcp-server-chart

Next, pick the tools you want to expose to your agent.

image

Custom Component

‘News Search’ is a custom component which searches news via Google RSS. Custom components can be implemented in Python.

image

All tools (MCP, custom, prebuilt) can be wired to agents.

MCP Server

Agentic flows built with Langflow can also be deployed as MCP servers so that they can be integrated in other agentic applications.

image

image

Setup

The setup of Langflow is easy.

1
2
3
4
5
python3.13 -m venv venv
source venv/bin/activate
uv pip install langflow
uv run langflow run
open http://localhost:7860/flows

Next Steps

To learn more, check out the documentation of Langflow.

Featured Blog Posts
Disclaimer
The postings on this site are my own and don’t necessarily represent IBM’s positions, strategies or opinions.
Contents
Trending Tags