What Is LangFlow?
LangFlow is a visual IDE for building LLM-powered applications using LangChain under the hood. Instead of writing Python to wire together prompts, memory, tools, and models, you drag component nodes onto a canvas and connect them with edges. The result is a flow that can be deployed as an API endpoint, a chat interface, or an embedded widget.
LangFlow has become popular among teams who want fast iteration without deep engineering overhead. It supports all major LLM providers (OpenAI, Anthropic, Mistral, Groq), dozens of built-in tools, custom Python components, and webhook triggers. The visual canvas makes complex agent architectures readable — you can see at a glance which tools the agent has access to and how data flows between steps.
What it has not had natively, until now, is a crypto-native financial toolset. Adding Purple Flea fixes that. Once connected, your LangFlow agent can check wallet balances, place perpetual futures trades, register domains, and spin casino games — all from the same visual canvas you already use for everything else.
Prerequisites
Before starting, you will need:
- A running LangFlow instance (cloud at
langflow.orgor self-hosted via Docker) - A Purple Flea API key — get one free at purpleflea.com/get-api-key
- An LLM API key (OpenAI, Anthropic, or any supported provider)
New to Purple Flea? Your API key grants access to all six services — trading, casino, wallet, domains, escrow, and the faucet — from a single credential. No separate sign-ups per service.
Step-by-Step: Adding Purple Flea as a Custom Tool
Open LangFlow and Create a New Flow
In the LangFlow dashboard, click New Flow and choose the blank canvas template. You will build from scratch so you understand each component. Name the flow Purple Flea Crypto Agent.
Add a Chat Input Node
From the component sidebar, drag a Chat Input node onto the canvas. This is where the user's message enters the flow. Leave default settings — it accepts text input and passes it to the connected agent.
Add an Agent Node
Drag an Agent node (under the Agents category) onto the canvas. Connect the Chat Input's Message output to the Agent's Input Message input. In the Agent node settings, select your preferred LLM and paste your LLM API key into the credentials field.
Add a Custom API Tool Node for Purple Flea
Drag a Custom Component node onto the canvas (under the Tools category, look for
API Request or Custom Tool). This node will wrap the Purple Flea API. In the
node configuration, set the base URL to https://purpleflea.com/api/v1 and add the
header Authorization: Bearer YOUR_API_KEY. Connect this tool node to the Agent's
Tools input port.
Define the Tool Schema as JSON
LangFlow's custom tool expects an OpenAI-compatible function schema. Paste the following into the component's Tool Schema field:
{
"name": "purple_flea",
"description": "Interact with Purple Flea financial services: check wallet balance, place trades, play casino, register domains, use escrow, or claim faucet credits.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"wallet_balance",
"trade_open",
"trade_close",
"casino_play",
"domain_register",
"escrow_create",
"faucet_claim"
],
"description": "The Purple Flea action to perform"
},
"params": {
"type": "object",
"description": "Action-specific parameters. For trade_open: {market, side, size_usd, leverage}. For casino_play: {game, bet_amount}. For domain_register: {domain}."
}
},
"required": ["action"]
}
}
This schema tells the LLM exactly what actions are available and what parameters each action takes. The LLM uses this schema to decide when to call Purple Flea and what arguments to pass.
Building the Wallet + Trade Flow
Now that the tool is connected, let's build a practical flow: the agent checks the wallet balance, and if it has sufficient funds, opens a trade position. Visually in LangFlow this looks like:
- Chat Input → "Check my balance and open a long BTC position if I have more than $100"
- Agent calls
purple_flea(action="wallet_balance") - Agent receives balance, evaluates condition
- Agent calls
purple_flea(action="trade_open", params={market:"BTC-PERP", side:"long", size_usd:50, leverage:2}) - Chat Output → confirmation message with position details
In the canvas, you can see each tool call as a node execution. LangFlow logs all inputs and outputs in the sidebar, making it easy to debug and iterate on the flow without touching code.
Handling Output from Purple Flea
Purple Flea API responses are standard JSON. When the agent receives a response, the LLM processes it according to its system prompt and formats a user-facing message. Here is an example response from a wallet balance check:
{
"status": "ok",
"wallet": {
"usdc_balance": 247.83,
"btc_balance": 0.00312,
"eth_balance": 0.148,
"total_usd_value": 431.22,
"open_positions": 1,
"unrealized_pnl_usd": 12.45
}
}
The LLM agent interprets this output and can conditionally trigger the next tool call. Add a System Prompt node to the Agent to instruct it on how to format these outputs: "When reporting wallet balance, always include total USD value and any open positions."
Adding Memory for Persistent Agent State
For a crypto agent, persistent memory is valuable — the agent should remember which positions it has opened, what its last trade was, and what its target allocation looks like. In LangFlow, add a ConversationBufferMemory node and connect it to the Agent's Memory input. This keeps the full conversation history in the agent's context window, allowing multi-turn reasoning across complex trading decisions.
For longer-running agents, consider using a VectorStore Memory node backed by a local Chroma or Pinecone instance. This allows the agent to retrieve relevant past trades semantically — for example, "recall all times I traded BTC with a loss" — without blowing the context limit.
Deploying Your Flow as an API
Once the canvas is ready, click API in the top-right of LangFlow to generate a REST endpoint for your flow. The endpoint accepts POST requests with a JSON body:
curl -X POST https://your-langflow.com/api/v1/run/FLOW_ID \ -H "Content-Type: application/json" \ -H "x-api-key: YOUR_LANGFLOW_API_KEY" \ -d '{"input_value": "Check my wallet balance", "tweaks": {}}'
This endpoint can be called by other agents, scheduled jobs, or web interfaces. A cron agent could call this every hour to monitor positions and auto-close them if conditions are met.
LangFlow vs. Flowise vs. LangChain Direct
Purple Flea works equally well across all three:
- LangFlow — visual canvas, fastest to prototype, best for non-developers
- Flowise — similar visual approach, slightly different node library, also supports custom tool schemas
- LangChain direct — full control via Python, best for production agents with complex logic
The same tool schema JSON works across all three. The only difference is where you paste it.
In LangFlow and Flowise it goes in the component settings. In LangChain direct, you define it
as a StructuredTool object in Python.
Next Steps
You now have a LangFlow agent with live crypto capabilities. Some ideas for extending it:
- Add a Scheduler trigger to run the agent every 15 minutes for automated trading checks
- Add a Webhook input to react to price alerts from TradingView or Hyperliquid
- Add the casino action and use Kelly criterion sizing to play conservatively with small allocations
- Add the faucet_claim action for new agent instances to bootstrap themselves with free starting credits
- Use the escrow_create action to sell trading signals from this agent to other agents programmatically