Langflow + Ollama: Build Production-Ready AI Agents Without Writing Python
If you've tried building AI agents with Python, you know the drill: installing dependencies, debugging async functions, wrestling with LangChain's abstractions. It works, but it's slow. And if you're not a Python developer, it's a wall.
Langflow changes that. It's a visual builder for LLM applications that lets you drag, drop, and connect components to create production-ready AI agents. Pair it with Ollama for local model hosting, and you've got a private, cost-free AI stack running on your own infrastructure.
Here's how to set it up and build your first agent.
What You're Building
By the end of this guide, you'll have:
- Langflow running as your visual AI workflow builder
- Ollama serving local LLMs (no API keys, no token costs)
- A working AI agent that can use tools and execute tasks
- Everything deployed on your own infrastructure
Why Ollama + Langflow?
The combination solves three problems at once:
| Problem | Solution |
|---|---|
| API costs adding up | Ollama runs models locally, zero token fees |
| Data privacy concerns | Everything stays on your machine |
| Python complexity | Langflow's visual editor, no code required |
Ollama handles the model serving. Langflow handles the orchestration. You handle the coffee.
Step 1: Deploy Langflow on Elestio
Skip the Docker setup headaches. On Elestio, select Langflow from the marketplace, pick your provider (2 CPU / 4 GB RAM minimum), and click Deploy.
Your instance will be ready in a few minutes with HTTPS, backups, and updates handled automatically.
Once deployed, access the Langflow UI through your instance URL. You'll see the visual canvas where you'll build your agents.
Step 2: Set Up Ollama
You'll need Ollama running alongside Langflow. If you're using Elestio, deploy an Ollama instance on the same provider.
SSH into your Ollama instance and pull a model that supports tool calling:
ollama pull qwen2.5:7b
Qwen 2.5 7B is solid for agent workflows. It handles tool calling well and runs on modest hardware. For beefier setups, try llama3.1:8b or mistral:7b.
Verify it's running:
curl http://localhost:11434/api/tags
You should see your model listed.
Step 3: Connect Langflow to Ollama
In Langflow, create a new flow. From the components panel, drag an Ollama node onto the canvas.
Configure the connection:
- Base URL:
http://your-ollama-ip:11434(use internal IP if both are on Elestio) - Model:
qwen2.5:7b - Temperature:
0.7(adjust based on your needs)
Click the "Tool Model Enabled" toggle to filter for models that support function calling. This is critical for agents.
Step 4: Build Your First Agent
Now the fun part. We'll create an agent that can search the web and summarize results.
Drag these components onto the canvas:
- Agent component (the brain)
- Ollama component (the LLM)
- Search API tool (DuckDuckGo works without API keys)
- Chat Input (user messages)
- Chat Output (agent responses)
Connect them:
Chat Input → Agent → Chat Output
↑
Ollama
↑
Search API Tool
In the Agent component, connect the Ollama node to the "Language Model" input. Connect the Search API to the "Tools" input.
That's it. You've built an AI agent without writing a single line of Python.
Step 5: Test in the Playground
Click the Playground button. Type a query:
What are the latest developments in self-hosted AI tools?
Watch the agent reason through the task. It'll decide to use the search tool, fetch results, and synthesize an answer. The execution trace shows exactly what's happening at each step.
Exporting for Production
Langflow flows export as JSON. Click the export button and save your flow. You can:
- Import it into other Langflow instances
- Version control it with Git
- Deploy it as a REST API endpoint
For API deployment, Langflow exposes your flow at:
POST /api/v1/run/{flow_id}
Send messages via HTTP and integrate with any application.
Adding Custom Tools
Pre-built tools are nice, but custom tools are where agents get powerful. Langflow supports Python functions as tools.
Create a custom component:
from langflow.custom import Component
from langflow.io import MessageTextInput, Output
class StockPrice(Component):
display_name = "Stock Price Checker"
inputs = [
MessageTextInput(name="symbol", display_name="Stock Symbol")
]
outputs = [
Output(display_name="Price", name="price", method="get_price")
]
def get_price(self) -> str:
symbol = self.symbol
# Your API call here
return f"Price for {symbol}: $150.00"
Upload this to Langflow, and your agent can now check stock prices alongside web searches.
Troubleshooting
Agent not using tools? Make sure your Ollama model supports tool calling. Not all do. Qwen 2.5, Llama 3.1, and Mistral work. Older models like Llama 2 don't.
Connection refused to Ollama? Check the base URL. If both services are on the same network, use the internal IP. Verify Ollama is listening on 0.0.0.0:11434, not just localhost.
Slow responses? Local models need compute. For 7B models, 8GB RAM works but 16GB is comfortable. Consider quantized models (Q4_K_M) for faster inference on limited hardware.
Flow not saving? Browser cache issues. Clear cache or try incognito mode. Langflow autosaves, but manual exports are good practice.
What's Next
You've got the foundation. From here, you can:
- Add RAG capabilities with vector stores (Qdrant, Chroma)
- Build multi-agent systems where agents collaborate
- Create MCP servers for tool standardization
- Integrate with your existing APIs and databases
The visual approach isn't just for prototyping. Teams run production workloads on Langflow because the flows are auditable, shareable, and don't require everyone to be a Python expert.
Self-hosted AI agents used to require serious engineering effort. With Langflow and Ollama on Elestio, you're building production-ready workflows in an afternoon.
Thanks for reading. See you in the next one.