TOOL WIKI · MODELS & SERVING

Ollama

Runs supported models through a local model-management and serving interface.

Download example files Code + setup + checks in a ZIP
Jump to a section 10 sections

EXAMPLE USE CASE

Run a policy-question baseline on a local model

An agent application needs a working model or inference-service boundary before adding retrieval, tools and production traffic.

Input
A pulled local model and a non-streaming request containing the policy.
Expected output
The answer returned by the loopback chat API.
  • Success check: The configured inference route returns an answer using the supplied 30-day policy.
  • Try a failure: An absent model or stopped server should surface as a setup error; unsupported facts must not be accepted as policy.

Example scope: Actual local inference; the sample does not add retrieval or tool execution.

Official reference · Ollama

WHAT IT ISModel runtime
WHERE IT FITSModels & serving
SEE HOW THE SYSTEM FITS TOGETHERSELECT A COMPONENT
inputprocessresultcheckoutputApplication requestModel + token budgetOllamaModel runtimeProvider or modelruntimeInference resourcesModel responseText or tool requestUsage + latencyWhole-request telemetryEvaluationTask-level quality
  1. Choose the model endpoint and send only the context required for this task.

  2. Local development and applications with a local inference requirement. Check tool calling and structured output support for the selected model.

  3. Make the actual provider, weights, hardware, and supported API explicit.

  4. Validate the returned structure and route proposed tools through application policy.

  5. Capture failures, token use, queue time, and response latency.

  6. Compare the deployed model configuration against repeatable fixtures.

    Result or stopping point
Ollama

Local development and applications with a local inference requirement. Check tool calling and structured output support for the selected model.

Follow the arrows, then select a component to inspect its responsibility. On mobile, downward arrows connect the next step; bent arrows identify branches and return paths. Select a destination to jump to that component.

When to consider it

  • Local development and applications with a local inference requirement.

A design decision to make

  • Check tool calling and structured output support for the selected model.

Prerequisites and setup

  • Ollama installed/running and enough memory for the selected local model. The displayed 3B model is a fixed lab example.
Shell
python3 -m venv .venv
source .venv/bin/activate
pip install requests
export OLLAMA_MODEL="llama3.2:3b"
ollama pull "$OLLAMA_MODEL"

Try a small integration

local.py

Python · local.py
import os
import requests

response = requests.post("http://127.0.0.1:11434/api/chat",timeout=120,
    json={"model":os.environ["OLLAMA_MODEL"],"stream":False,
          "messages":[{"role":"user","content":"Policy: returns are accepted within 30 days. Can an item be returned after 20 days? Answer briefly using only this policy."}]})
response.raise_for_status()
print(response.json()["message"]["content"])

Run and check the result

Shell
# Start the local Ollama service if the desktop app is not already serving.
ollama serve
# In another terminal:
python local.py
  • The configured inference route returns an answer using the supplied 30-day policy.
  • stream=False yields one JSON response; streaming mode yields multiple events and needs an incremental parser.

Common failures

  • A healthy HTTP server does not prove the model loaded or a request completed. Check model readiness and an actual response separately.
  • Model identifiers, context length and supported parameters differ by backend; do not assume an OpenAI-compatible endpoint supports every API feature.

Production decisions

  • Pin the model, tokenizer/chat template, runtime and request settings. Benchmark the actual workload for latency, memory, concurrency and quality.
  • Keep model endpoints authenticated and scoped; cap request/output sizes, enforce deadlines and redact telemetry.
  • Distinguish local and cloud model routes. Keep a local unauthenticated API on loopback unless an authenticated gateway protects it.

Keep exploring

A map of the agent development stackThe real cost of an agent run

Explore the same layer

LiteLLMvLLMSGLangBentoML

Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.