Agents / WORKFLOW

Build a local AI tool agent with Qwen3 8B

Run a bounded local function through Qwen3 8B and inspect the tool call, tool result, and final answer.

EstimatedSource checked 9/29/2026
LOCALRENTED GPU
Freshness 12 out of 100. Repository age: 560 days old, Apr 27, 2025. Measures age, not quality.
Popularity 92 out of 100. 6,976,036 downloads in 30 days; 2,175 lifetime likes. Checked Nov 7, 2026. Measures adoption, not quality.
What do these scores mean?

Two ways to compare models. Neither score measures answer quality, benchmark performance, or whether a model fits your machine.

Freshness · release age

A new release starts at 100. The score halves every 180 days: 100 × 2^(−age in days / 180). When the release date is unavailable, a repository date is a fallback—not proof of when the model was released. Missing dates stay unscored.

Check the date source
Popularity · adoption

Downloads over the past 30 days carry 80% of the score; lifetime likes carry 20%. Both use a logarithmic scale, capped at 10 million downloads and 100,000 likes. If likes are unavailable, downloads carry all the weight. Missing download statistics stay unscored.

round(80 × min(1, log10(1 + downloads) / 7) + 20 × min(1, log10(1 + likes) / 5))

Check the statistics source
Scores as of Nov 8, 2026. Statistics checked Nov 7, 2026. Statistics are marked for refresh after 72 hours.Full scoring method

Before you begin

Hardware

Estimated memory starting points for the 5.2 GB Qwen3 8B Ollama package with one tool and 4K context. Runtime and KV cache need extra memory beyond the download.

MachineQwen3 · 8B
NVIDIA GPU · 8 GBPossible with CPU offload and 16 GB-plus system RAM; check ollama ps.
NVIDIA GPU · 12 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
NVIDIA GPU · 16 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
NVIDIA GPU · 24 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
NVIDIA GPU · 32 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
AMD Radeon · 8 GBPossible with CPU offload and 16 GB-plus system RAM; check ollama ps.
AMD Radeon · 16 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
AMD Radeon · 24 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
AMD Radeon · 32 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
Intel Arc · 8 GBPossible with CPU offload and 16 GB-plus system RAM; check ollama ps.
Intel Arc · 16 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
Intel Arc · 24 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
Intel Arc · 32 GBRuns at 4K if Ollama loads the package on this GPU; check ollama ps.
Apple Silicon · 16 GB unifiedRuns at 4K with room for one tool; longer history uses more memory.
Apple Silicon · 24 GB unifiedRuns at 4K with room for one tool; longer history uses more memory.
Apple Silicon · 32 GB unifiedRuns at 4K with room for one tool; longer history uses more memory.
Apple Silicon · 64 GB unifiedRuns at 4K with room for one tool; longer history uses more memory.
CPU-only · 16 GB RAMCan run from system RAM at 4K; expect slower tool turns than GPU.
CPU-only · 32 GB RAMCan run from system RAM at 4K; expect slower tool turns than GPU.
CPU-only · 64 GB RAMCan run from system RAM at 4K; expect slower tool turns than GPU.

These are memory-fit starting points, not performance tests. Check the exact AMD or Intel Ollama backend and use ollama ps to see the GPU/CPU split; longer context or image input needs more memory.

LOCAL AGENT / OLLAMASOURCE-LINKED SETUP

Let Qwen3 request one safe local tool.

Install the Qwen3 8B Ollama package, run a small Python tool loop, and check the returned value against the local lookup. Use the Windows, Mac, or Linux route for the same task.

Choose a package Run its commands Check the result
01
BEFORE YOU BEGIN

The documented package

This setup uses the package documented for this task. Review its source and supported platforms before starting.

Save your machine in My Hardware to get an automatic starting choice. You can always choose any package yourself.

CURRENT SETUP

Qwen3 · 8B · official

The Qwen3 8B package downloads 5.2 GB. Start with 4K context. An 8 GB GPU may need CPU offload; 12 GB GPU or 16 GB Apple Silicon unified memory is an estimated smoother starting point. Check ollama ps rather than assuming speed from weight size.

Freshness 12 out of 100. Repository age: 560 days old, Apr 27, 2025. Measures age, not quality.
Popularity 92 out of 100. 6,976,036 downloads in 30 days; 2,175 lifetime likes. Checked Nov 7, 2026. Measures adoption, not quality.
What do these scores mean?

Two ways to compare models. Neither score measures answer quality, benchmark performance, or whether a model fits your machine.

Freshness · release age

A new release starts at 100. The score halves every 180 days: 100 × 2^(−age in days / 180). When the release date is unavailable, a repository date is a fallback—not proof of when the model was released. Missing dates stay unscored.

Check the date source
Popularity · adoption

Downloads over the past 30 days carry 80% of the score; lifetime likes carry 20%. Both use a logarithmic scale, capped at 10 million downloads and 100,000 likes. If likes are unavailable, downloads carry all the weight. Missing download statistics stay unscored.

round(80 × min(1, log10(1 + downloads) / 7) + 20 × min(1, log10(1 + likes) / 5))

Check the statistics source
Scores as of Nov 8, 2026. Statistics checked Nov 7, 2026. Statistics are marked for refresh after 72 hours.Full scoring method
View weight source
02
THE WORKFLOW

Set up Qwen3 · 8B on your machine

Choose where you want to run it. The instructions below update to match your selection.

CHOOSE YOUR SETUPMac

Use Terminal on Apple Silicon. Ollama for macOS is available from the official download page.

02

Check the runtime and Python

In Terminal, confirm Ollama and Python 3 are available. Install Python 3 first if python3 is not found.

Install Python 3
ollama --version python3 --version
03

Download qwen3:8b

Pull the exact package before running the example, so model download failures are separate from Python errors.

ollama pull qwen3:8b
04

Install the local Python libraries

The official Ollama Python client connects to the service on your own machine.

python3 -m pip install --upgrade ollama
05

Create tool_agent.py

In Terminal, paste this block. It writes the complete small example as tool_agent.py in your current folder. Read the code before running it.

cat > tool_agent.py <<'PY' from ollama import chat def get_temperature(city: str) -> str: """Return the temperature from this local example lookup, not live weather.""" return {"New York": "22°C", "London": "15°C"}.get(city, "No sample value") messages = [{"role": "user", "content": "Using your tool, what is the sample temperature in New York?"}] response = chat(model="qwen3:8b", messages=messages, tools=[get_temperature], think=True) messages.append(response.message) if not response.message.tool_calls: raise RuntimeError("No tool call: check that qwen3:8b loaded and retry the exact question") call = response.message.tool_calls[0] if call.function.name != "get_temperature" or call.function.arguments.get("city") != "New York": raise ValueError("Unapproved tool name or city; no function was executed") result = get_temperature(**call.function.arguments) print("Local tool result:", result) messages.append({"role": "tool", "tool_name": "get_temperature", "content": result}) final = chat(model="qwen3:8b", messages=messages, tools=[get_temperature], think=True) print("Final answer:", final.message.content) PY
06

Execute the tool loop

Run the Python script. It checks that the requested function is exactly get_temperature and the city is New York, executes the local lookup, returns a tool message, then asks Qwen3 for its final answer.

python3 tool_agent.py
07

Check the local result and placement

Look for Local tool result: 22°C and a final answer that uses 22°C. If the model does not request the tool, the script raises an error rather than pretending it succeeded. Use ollama ps to see CPU/GPU placement.

ollama ps
03
SUCCESS CHECK · Qwen3 · 8B

A completed local tool round trip

The Python output prints Local tool result: 22°C, then Qwen3 uses that tool result in its final answer. The function is only called after its name and arguments pass the allowlist. No shell or network tool is available.

The lookup is a deliberately static sample, not live weather. Never allow an AI-requested tool name or argument to execute before checking it. Start with 4K context; larger tool histories increase memory use.

Back to setup steps

When it doesn’t go to plan

No tool call returned.

Confirm qwen3:8b is installed, then rerun the exact sample question with tools=[get_temperature]. The script stops instead of inventing a tool result.

Unapproved function or arguments.

Keep the allowlist check. Do not execute unexpected tools; inspect the call and retry with a narrower prompt.

The second response ignores 22°C.

Confirm the assistant tool-call message and role="tool" result are both appended before the second chat request; compare the printed local value with the final answer.

REFERENCE LIBRARY

Sources and files

Original instructions, model files, and compatibility notes behind this setup.

4 SOURCES

The model behind this workflow

Qwen3 8B

Keep exploring

Text
SETUP GUIDE

Qwen3.5 · 9B private chat setup

Source-backed package and platform-route plan for private local chat with Qwen3.5 · 9B. Preserves the official Ollama 9B package, a smaller 4B family fallback, and a clearly labeled community uncensored GGUF option.

Freshness 38 out of 100. Release age: 254 days old, Feb 27, 2026. Measures age, not quality.
Popularity 91 out of 100. 6,321,700 downloads in 30 days; 2,329 lifetime likes. Checked Nov 7, 2026. Measures adoption, not quality.
SOFTWAREOllama
Coding
SETUP GUIDE

Build a private coding assistant with Qwen3.8 27B

Run Qwen3.8 27B with Ollama, connect it to Cline in VS Code, and make one reviewable code change in a tiny local project.

Freshness 69 out of 100. Repository age: 95 days old, Aug 5, 2026. Measures age, not quality.
Popularity 96 out of 100. 7,813,215 downloads in 30 days; 19,312 lifetime likes. Checked Nov 7, 2026. Measures adoption, not quality.
Arena Open Source Web coding: rank 12 of 62. Ranked model: Qwen3.8-27B. Original model ranking, not a benchmark of this package. Export dated Nov 6, 2026. Source checked Nov 7, 2026. Human preference ranking, not hardware suitability.+3
SOFTWAREOllama + Visual Studio Code + Cline + Python
Images
SETUP GUIDE

Create images locally with FLUX.2 Klein

Generate images from text prompts in ComfyUI with the fast distilled or more adjustable base 4B model. Save your results and reuse the visual workflow.

Freshness 32 out of 100. Release age: 297 days old, Jan 15, 2026. Measures age, not quality.
Popularity 77 out of 100. 435,063 downloads in 30 days; 1,097 lifetime likes. Checked Nov 7, 2026. Measures adoption, not quality.
SOFTWAREComfyUI
Build a local AI tool agent with Qwen3 8B | YouRunAI