Build a Local Tool-Using Agent

Build a local Langflow agent that uses Ollama and auditable tools.

Introduction

30 Second Summary

When a calculation matters, a confident-looking answer is only useful if you can see how it was produced. Without that evidence, a correct result can still feel like a guess.

In this project, you will build a local math agent in Langflow powered by qwen3:4b through Ollama. In Playground, its trace shows the selected Calculator tool, exact input, result, and final response.

What You'll Build

Your finished assistant turns Calculate 37*84+19. Do not estimate. into 3127 while an expanded Calculator trace reveals exactly how the result was produced.

By the end of this project, you'll have:

  • A local math assistant you can reopen to process prompts through qwen3:4b without using a paid model provider.
  • A before-and-after demonstration showing the missing Calculator call before Tool Mode registration and the visible tool call after registration.
  • An auditable Calculator trace where you can inspect the expression passed to the tool, the returned result, and the agent's final response.
  • Secret Mission: Add the URL component as a second tool, then prove the agent selects it for a documentation-summary request.

Are there any prerequisites?

You need Windows 10 22H2 or newer with an existing Langflow Python-package environment. Keep at least 2.5 GB of free storage available for the local model.

Internet access is required for missing downloads. The Secret Mission also reads an online documentation page.

Before We Start

You are committing to build a local Langflow math agent in your existing Windows environment. Visible Calculator traces make each arithmetic result more trustworthy by showing that a dedicated tool produced it.

Prepare Langflow and Ollama

Your local math agent depends on compatible versions of Langflow, uv, and Ollama. A missing tool can prevent the visual flow from reaching your local model.

You will verify the existing Langflow environment against the pinned versions. You will also load qwen3:4b before starting the local server.

In this step, get ready to:
  • Verify uv 0.12.18 in your existing Langflow environment.
  • Prepare Ollama 0.34.3 with the local qwen3:4b model.
  • Start the Langflow server.
Verify uv and Langflow

Your existing Python-package environment keeps Langflow separate from other Python projects. You need to return to that environment before checking or changing its packages.

  • Press the Windows key to open the search bar.
  • Type Windows PowerShell into the search bar.
  • Press Enter to open Windows PowerShell.
  • Activate your existing Langflow environment with the same command you used when you created it.

Your PowerShell prompt should now show the name of your existing environment. This confirms that subsequent package commands target the right Python installation.

Can't activate the existing environment?

Locate the folder that contains the environment's Scripts directory. The activation command must point to that environment folder.

Ask for help with your existing environment path:

The uv version controls how the remaining commands run inside this environment. Check it before changing Langflow.

  • Check the installed uv version by running this command:
uv --version

What does this command do?

This command prints the installed uv version without changing your environment. The result determines whether you can continue or need the pinned installer.

✔️ I see version 0.12.18 or higher

Your uv installation is ready. Version 0.12.18 provides the package and command runner used throughout this project.

ⓧ I see an older version

Your current uv version is below the project pin. Install uv 0.12.18 before continuing.

  • Install the pinned uv version by running this command:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.12.18/install.ps1 | iex"

What does this command do?

This command downloads the official Windows installer for uv 0.12.18. It then runs that installer in PowerShell.

  • Close Windows PowerShell after the installer finishes.
  • Reopen Windows PowerShell through the Windows search bar.
  • Reactivate your existing Langflow environment.
  • Confirm the new uv version by running this command:
uv --version

What should I see?

This command reads the replacement installation. You should see uv version 0.12.18 in the output.

ⓧ Command not found

PowerShell cannot currently find uv. Install the pinned release before returning to your environment.

  • Install uv 0.12.18 by running this command:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/0.12.18/install.ps1 | iex"

What does this command do?

This command retrieves the official uv 0.12.18 installation script. PowerShell executes the script after the download completes.

  • Close Windows PowerShell after the installer finishes.
  • Reopen Windows PowerShell through the Windows search bar.
  • Reactivate your existing Langflow environment.
  • Verify the installation by running this command:
uv --version

What should I see?

This command confirms that PowerShell can now find uv. You should see version 0.12.18 in the output.

Still unable to run uv?

Close every PowerShell window after installing uv. A newly opened window reloads the command locations available to your account.

Ask for help with the uv installation:

Langflow must match the version used by the visual components in this project. Check the package inside the active environment before starting the server.

  • Check the installed Langflow version by running this command:
uv run langflow --version

What does this command do?

The uv run runner executes Langflow from the active Python environment. The version option prints the installed Langflow release.

✔️ I see version 1.12.3

Your existing environment already contains Langflow 1.12.3. The visual components now match the project instructions.

ⓧ I see an older version

Your environment contains a different Langflow release. Align it with the project pin before continuing.

  • Install Langflow 1.12.3 into the active environment by running this command:
uv pip install langflow==1.12.3

What does this command do?

This command installs the pinned Langflow package into the active environment. Pinning the package keeps the canvas controls consistent with the walkthrough.

  • Confirm the aligned Langflow version by running this command:
uv run langflow --version

What should I see?

This command checks the package after installation. You should see Langflow version 1.12.3 in the output.

ⓧ Langflow is unavailable

The active environment does not currently provide the Langflow command. Install the pinned package into this environment.

  • Install Langflow 1.12.3 by running this command:
uv pip install langflow==1.12.3

What does this command do?

This command adds the Langflow Python package to the active environment. It pins the package to version 1.12.3 for this project.

  • Verify the Langflow installation by running this command:
uv run langflow --version

What should I see?

This command runs the newly installed Langflow executable. You should see version 1.12.3 in the output.

Langflow version still incorrect?

Check that your PowerShell prompt still shows the existing Langflow environment. Installing from another environment changes a different Python package set.

Ask for help aligning the package:

Prepare Ollama and qwen3:4b

Ollama runs your local language model on your Windows computer. The Qwen3 model keeps the later chat requests local.

  • Check the installed Ollama version by running this command:
ollama -v

What does this command do?

This command asks the Ollama command-line application to print its installed version. It also confirms that PowerShell can find Ollama.

✔️ I see version 0.34.3 or higher

Ollama is available in PowerShell. Version 0.34.3 matches the release used for this project.

ⓧ I see an older version

Your Ollama installation needs the current Windows release. The official installer updates the background application and command-line tool.

  • Navigate to the official Ollama Windows documentation in your available browser.
  • Download OllamaSetup.exe.
  • Run OllamaSetup.exe from your Downloads folder.
  • Follow the installer prompts with their default options.
  • Reopen Windows PowerShell after the installation finishes.
  • Reactivate your existing Langflow environment.
  • Confirm the updated Ollama version by running this command:
ollama -v

What should I see?

This command checks the updated Ollama application. You should see version 0.34.3 or higher.

ⓧ Command not found

Ollama is not available to PowerShell yet. Install the official Windows application before loading the model.

  • Navigate to the official Ollama Windows documentation in your available browser.
  • Download OllamaSetup.exe.
  • Run OllamaSetup.exe from your Downloads folder.
  • Follow the installer prompts with their default options.
  • Reopen Windows PowerShell after the installation finishes.
  • Reactivate your existing Langflow environment.
  • Verify Ollama by running this command:
ollama -v

What should I see?

This command confirms that the installer added Ollama to your command path. You should see version 0.34.3 or higher.

PowerShell still cannot find Ollama?

Confirm that you reopened PowerShell after the installation. Ollama runs as a Windows background application after the installer completes.

Ask for help with the Windows installation:

Ollama keeps downloaded models on your computer. Listing those models tells you whether qwen3:4b is already stored locally.

  • List the local Ollama models by running this command:
ollama ls

What does this command do?

This command prints the models stored by Ollama. Look for qwen3:4b in the model-name column.

The first model run downloads approximately 2.5 GB when qwen3:4b is absent. A long download pause is expected because Ollama stores the complete model locally.

  • Start a local qwen3:4b chat by running this command:
ollama run qwen3:4b

What does this command do?

This command opens an interactive chat with qwen3:4b. Ollama downloads the model first when it is not already stored locally.

  • Submit this short local test message after the chat prompt appears:
Reply with one short sentence.

What does this test prove?

This prompt asks the local model for a small response. A reply confirms that Ollama can load qwen3:4b and generate text.

That is the model check complete. Your local qwen3:4b model can now respond without a paid model provider.

  • Exit the interactive chat by entering:
/bye

What does this command do?

This command closes the Ollama chat session. It returns control of the PowerShell prompt without removing the downloaded model.

  • Confirm that the model is stored locally by running this command:
ollama ls

What should I see?

The local model list should now include qwen3:4b. This confirms that Langflow can select it later through the Ollama component.

Model download or response failed?

Confirm that Ollama is running in the Windows background. Check that your computer has at least 2.5 GB of free model storage.

Ask for help with the local model:

Start Langflow and open the Projects page

The Langflow server turns your existing Python environment into a local visual workspace. It must remain running while you build and test the agent.

  • Start the Langflow server by running this command:
uv run langflow run

What does this command do?

This command launches the Langflow server from the active environment. The server listens at the default local Langflow address.

The server keeps this PowerShell window busy while it runs. Its startup messages show that the local service is active.

  • Leave this PowerShell window running.

Langflow server did not start?

Confirm that the PowerShell prompt showed your existing Langflow environment before you started the server. Check that the earlier version command returned Langflow 1.12.3.

Ask for help with the local server:

You will use Microsoft Edge to reach the visual workspace. Open the browser through Windows search so you can confirm it is available.

  • Press the Windows key to open the search bar.
  • Type Microsoft Edge into the search bar.
  • Press Enter to open Microsoft Edge.

✔️ Microsoft Edge opens

Microsoft Edge is ready to load the local Langflow address. Keep the browser open for the final check.

ⓧ Microsoft Edge is unavailable

Install Microsoft Edge before opening the visual workspace. You can use another available browser to reach the official download page.

  • Navigate to the Microsoft Edge download page in your available browser.
  • Download Microsoft Edge for Windows.
  • Run the downloaded installer from your Downloads folder.
  • Follow the installer prompts with their default options.
  • Open Microsoft Edge through the Windows search bar after installation.

Before you load the local address, do you expect a visual project workspace or a model chat prompt?

  • Select the address bar in Microsoft Edge.
  • Enter http://127.0.0.1:7860 to load the local Langflow server.

You should see the Langflow Projects page in Microsoft Edge. You have now proved that the pinned environment, local model, server, and browser can work together.

✔️ Everything is ready

Your local environment is ready. Keep the Langflow PowerShell window running while you continue.

ⓧ I'd like to double check the setup

Langflow server: Running locally from the existing environment with uv run langflow run and reachable at http://127.0.0.1:7860 in Microsoft Edge.

Local development environment: Windows 10 22H2 or newer with Windows PowerShell, uv 0.12.18, Langflow 1.12.3 in the existing Python-package environment, Ollama 0.34.3, Microsoft Edge, and internet access available as needed.

Ollama model qwen3:4b: Downloaded locally, listed by ollama ls, tested with a short local response, and stored locally using approximately 2.5 GB.

Your local services are ready for visual agent work. Next, you will assemble the first Langflow chat flow and get a response from qwen3:4b.

Build the First Local Agent

Your local Langflow server is running. Your qwen3:4b model in Ollama has already answered a test prompt.

Now you'll combine them in a visual flow that powers a local AI agent. A successful Playground reply gives you an early visible win before you add tools.

In this step, get ready to:
  • Create a Blank Flow with the four chat components.
  • Connect the local model to the Agent.
  • Verify one local response in Playground.
Create the Blank Flow

A visual flow represents each stage of an application as a component on a canvas. Your first flow needs separate components for receiving a message, generating a response, coordinating the request, and displaying the result.

  • Click Blank Flow on the Projects page.

You'll see the visual editor with an empty canvas. This canvas is where you assemble the local agent.

  • Use the component search in the left sidebar to find Chat Input.
  • Drag Chat Input onto the canvas.

You'll see the Chat Input component on the canvas. It provides the message that starts each Playground run.

  • Use the component search in the left sidebar to find Ollama.
  • Drag Ollama onto the canvas.

You'll see the Ollama component beside Chat Input. This component connects the flow to your local model.

  • Use the component search in the left sidebar to find Agent.
  • Drag Agent onto the canvas.

You'll see the Agent component on the canvas. It coordinates the incoming message with the connected language model.

  • Use the component search in the left sidebar to find Chat Output.
  • Drag Chat Output onto the canvas.

Solid start. Your canvas now shows Chat Input, Ollama, Agent, and Chat Output.

Langflow auto-saves the current flow draft in the background. Your Blank Flow is stored as you work.

Connect the local model

The Ollama component needs a server address, a model selection, and an output type. These settings let Agent use your local model as its language engine.

  • Select the Ollama component on the canvas.
  • Enter http://127.0.0.1:11434 in the Base URL field.

The Base URL field now points to the Ollama service running on your computer.

  • Click Refresh in the Ollama component.

You'll see the Model Name list reload with the models available from your local Ollama installation.

  • Select qwen3:4b in the Model Name field.
  • Change the Ollama output to Language Model (LanguageModel).

The Ollama output port now represents a language model that Agent can call.

Why connect Ollama directly?

Connecting Ollama's LanguageModel output keeps model processing on your computer. It also gives Agent the model interface it expects.

This approach avoids external model credentials. Your local qwen3:4b model handles the prompt.

  • Drag a connection from Ollama's LanguageModel output to the Agent Language Model input.
  • Drag a connection from the Chat Input output to the Agent input.

You'll see two connector lines entering Agent. One supplies the local model while the other supplies the chat message.

  • Drag a connection from the Agent Response (response) output to the Chat Output input.

The canvas now shows three connector lines. They link Ollama to Agent, Chat Input to Agent, and Agent to Chat Output.

Can't load the local model?

  • Confirm the Ollama background application is still running.
  • Check that the Base URL field contains http://127.0.0.1:11434.
  • Select Refresh again after confirming the local service is available.

If the model list still stays empty, help me troubleshoot the Ollama connection in Langflow.

Run the flow in Playground

Playground sends a message through the connected Chat Input. The returned message appears through Chat Output, which makes the complete path visible.

  • Click Playground in the flow editor.
  • Enter In one sentence, explain what an AI agent is. in the chat input field.

Before you submit it, do you expect the response to travel through the local model and appear in Chat Output?

  • Submit the prompt.

You'll see a one-sentence explanation in Chat Output. The exact wording can vary because the local model generates the response.

You now have your first working local agent. The flow carries a message from Chat Input through qwen3:4b before displaying the result in Chat Output.

No response in Playground?

  • Return to the visual editor.
  • Confirm each of the three connector lines is still visible.
  • Confirm qwen3:4b remains selected in the Ollama component.

If Playground still cannot return a message, help me diagnose my local Langflow agent flow.

Your saved flow now produces a local response from end to end. Next, you'll put its current capabilities under closer inspection.

Expose the Tool-Free Limitation

Your local Langflow flow already returns responses from qwen3:4b. That proves the path from Chat Input to Chat Output works.

A fluent response still leaves one question unanswered: whether the Agent executed a tool.

In this step, you'll test the current flow without changing it. Playground will reveal whether Calculator produced auditable evidence.

In this step, get ready to:
  • Ask the Agent which tools it has available.
  • Submit an exact arithmetic request to the tool-free Agent.
  • Inspect the Playground run for Calculator evidence.
Check the agent's connected tools

Registered tools give an Agent capabilities beyond generated text. Asking about those capabilities establishes a baseline before the arithmetic test.

  • Return to the saved Blank Flow in Microsoft Edge.
  • Click Playground in the flow editor.
  • Enter this question in Playground by pasting the text below:
What tools are you using to answer my questions?

What does this question test?

This question checks the Agent's description of its available capabilities. Your flow canvas remains the source of truth for what is connected.

  • Submit the question by pressing Enter.
  • Read the response from qwen3:4b.

The wording can vary. Calculator should not appear as a connected capability because the Agent's Tools input has no connection.

No response in Playground?

  • Confirm Langflow remains running in the existing PowerShell window.
  • Verify Chat Input still connects to the Agent input in the visual editor.
  • Verify the Agent response output still connects to Chat Output.

Help me diagnose why my existing Langflow Agent flow does not respond in Playground.

Reveal the missing Calculator trace

A tool trace makes an executed action visible. This check focuses on that evidence instead of judging the numerical response alone.

  • Enter the arithmetic request in Playground by pasting the exact text below:
Calculate 37*84+19. Do not estimate.

Why use this arithmetic request?

The request demands exact arithmetic. The Playground run lets you check whether that work came from an executed Calculator component or generated text.

Before you submit this, ask yourself: can Playground show Calculator evidence when the Agent has no connected tools? Hold onto your prediction.

  • Submit the request by pressing Enter.
  • Inspect the run details shown with the response.

You may receive a numerical answer from qwen3:4b. The run shows no Calculator tool call or Calculator result.

That absence is the intended shortfall. The model generated text without an auditable arithmetic action.

Seeing a Calculator trace?

  • Confirm you are inspecting the saved Blank Flow from this project.
  • Verify the Agent's Tools input has no connection.

Help me verify why my supposedly tool-free Langflow Agent shows a Calculator trace.

You have now pinned down the exact gap: this flow can answer without proving that Calculator ran.

Your tool-free baseline is captured. Next, you'll give the Agent an auditable arithmetic capability.

Register the Calculator Tool

Your last Langflow run proved that the local Agent can produce an arithmetic answer. Playground still showed no Calculator call or result.

A registered tool gives the Agent a dedicated arithmetic function. In this step, you'll connect Calculator through Tool Mode and make each call visible in Playground.

In this step, get ready to:
  • Register Calculator as an Agent tool through Tool Mode.
  • Set the Agent rule for arithmetic requests.
  • Verify the Calculator call in Playground.
Register Calculator as an Agent tool

Tool Mode turns a supported component into a callable tool. Its Toolset connection makes that capability available to the Agent.

  • Return to the visual canvas from the Playground.
  • Add the Calculator component to the existing Blank Flow.
  • Open the Calculator component's header menu.
  • Enable Tool Mode in that menu.
  • Connect the Calculator Toolset port to the Agent Tools port.
  • Confirm the canvas shows a connection line from Calculator Toolset to Agent Tools.

Good progress. The Agent now has a registered Calculator capability that Playground can trace.

Why This Connection Matters

Tool Mode exposes Calculator as a function the Agent can choose for arithmetic requests. The Toolset connection registers that function with this Agent.

When the Agent calls Calculator, Playground records the selected tool. It also records the tool's input and result.

Can't Connect Calculator to the Agent?

  • Confirm Tool Mode is enabled from Calculator's header menu.
  • Reconnect Calculator Toolset to Agent Tools if the connection line is missing.
  • Check that you added Calculator to the existing Blank Flow.

Ask for help with the connection: Help me connect Calculator to Agent Tools in Langflow.

Set the arithmetic instruction

Agent Instructions tell the model when it must use a connected tool. A precise rule makes the arithmetic path repeatable.

  • Select the Agent component on the existing canvas.
  • Locate the Agent Instructions field.
  • Enter For every arithmetic request, always use the Calculator tool and return the exact result. in Agent Instructions.
  • Save the updated flow from the flow header.
  • Confirm Agent Instructions still displays the exact sentence after the flow is saved.

The Agent now has a clear rule for every arithmetic request. Calculator is the required execution path.

Instruction Missing After Saving?

  • Select the Agent component again.
  • Compare Agent Instructions with the exact sentence above.
  • Save the flow again from the flow header.

Ask for help with the instruction: Help me check my Agent Instructions in Langflow.

Verify the Calculator trace

The tool trace is the evidence that separates an executed calculation from generated text. This run should expose the chosen tool before the final response.

Before you submit the request, do you expect the new run to show generated text only or an executed Calculator call?

  • Return to the Playground from earlier.
  • Enter Calculate 37*84+19. Do not estimate. in the connected Chat Input.
  • Submit the request through Chat Input.

This time, Playground shows a Calculator tool call before the Agent's final response.

  • Expand the Calculator tool trace.
  • Inspect the expression input sent to Calculator.
  • Inspect the result returned by Calculator.
  • Read the Agent's final response.

The expanded trace shows the arithmetic expression sent to Calculator. It also shows the returned result 3127.

The Agent's final response is 3127.

That closes the audit gap. Your arithmetic answer now comes with visible evidence of the tool input and result.

No Calculator Trace?

  • Confirm Tool Mode remains enabled on Calculator.
  • Confirm the Calculator Toolset connection still reaches Agent Tools.
  • Compare Agent Instructions with the exact sentence above.

Ask for help with the missing trace: Help me make my Langflow Agent call Calculator.

Secret mission

Add a URL Reading Tool

Your math agent has one dedicated capability. Add Langflow's URL component as a second tool, then prove the Agent can select the right tool for arithmetic and page-reading requests.

Clean Up Your Resources

Clean Up Your Resources

Choose whether to keep the local agent active, pause its services, or remove its saved resources. The project has no ongoing service or API fees.

Resources you used:

  • Active Langflow server process in Windows PowerShell.
  • Saved Blank Flow in Langflow.
  • Local Ollama model qwen3:4b using approximately 2.5 GB of storage.
  • Active Ollama background process serving the local model.

Keep everything running

No action needed. Choose this if you want to continue experimenting with your local tool-using agent.

  • Keep the Windows PowerShell window running Langflow open.
  • Leave the Ollama background application active.
  • Continue testing the saved Blank Flow in Microsoft Edge.

Pause - I'll come back to this later

Shut down the local processes to free up memory. Your saved resources remain ready for another session.

  • Switch back to the Windows PowerShell window running Langflow.
  • Press Ctrl+C to stop Langflow.
  • Use the Ollama tray icon to quit the background application.

Your saved Blank Flow remains available with its local history. The downloaded qwen3:4b model stays on disk.

Delete - I don't want to use this again

Remove the saved flow plus downloaded model. The installed applications stay available on Windows.

  • Return to the Langflow Projects page in Microsoft Edge.
  • Locate the saved Blank Flow.
  • Open the flow's menu.
  • Select Delete.
  • Confirm the flow deletion.

That is the main project cleanup done. The saved Blank Flow no longer appears on the Projects page.

  • Remove the downloaded qwen3:4b model by running this command:
ollama rm qwen3:4b

What does this command remove?

This command removes the downloaded model artifact from local storage. The deletion recovers approximately 2.5 GB.

  • Confirm the model no longer appears by running this command:
ollama ls

What should I see?

Your local model list should no longer include qwen3:4b. This confirms that its local storage has been released.

  • Switch back to the Windows PowerShell window running Langflow.
  • Press Ctrl+C to stop Langflow.
  • Use the Ollama tray icon to quit the background application.

Cleanup is complete. The saved flow plus local model are removed.

Nice Work!

Nice Work!

You did it! Your local AI agent now runs in Langflow with Ollama's qwen3:4b model.

You've learned how to:

  • Build a visual flow that passes messages from Chat Input to an Agent powered by qwen3:4b. Route the Agent response to Chat Output.
  • Use Playground traces to demonstrate the limitation of a tool-free Agent. Distinguish model-generated arithmetic from an executed tool result.
  • Register Calculator through Tool Mode. Inspect its expression input in Playground. Confirm the returned result before reading the final response 3127.
  • Secret Mission: Extend the Agent with a URL tool. Verify that arithmetic requests select Calculator. Verify that a documentation request selects URL. Receive a one-sentence summary based on the Langflow agents page.

Ready to quiz yourself?