@flwrlabs/hackathon-ollama-agent-recipe

1
0
flwr new @flwrlabs/hackathon-ollama-agent-recipe

Flower AgentApp with Ollama

A minimal Flower AgentApp that streams responses from a local Ollama model. It uses Flower's runtime bridge and requires no Flower account or model API key.

Requirements

  • Python 3.11+
  • Ollama 0.13.3+ with the default qwen3.5:4b model

Start Ollama and install the app:

ollama pull qwen3.5:4b
ollama serve  # Skip this if the Ollama desktop app is already running.

cd agent-ollama
uv sync

Run

Add a local Flower connection to ~/.flwr/config.toml:

[superlink.local-agent]
address = "127.0.0.1:9093"
insecure = true

This connection is for local development only. Do not expose it to an untrusted network.

Start SuperLink from agent-ollama:

export FLWR_MODEL_API_ENDPOINT="http://127.0.0.1:11434/v1/responses"
uv run flower-superlink --insecure

In another terminal, run the agent:

cd agent-ollama
uv run flwr run . local-agent --stream

To use another model, download it first and then pass its name to the agent. For example, to use qwen3.5:9b:

ollama pull qwen3.5:9b

With the new model enabled you can also change the agent input as follows:

uv run flwr run . local-agent \
  --run-config 'agent.model="qwen3.5:9b" agent.input="Explain why the sky is blue in one sentence."' \
  --stream

Defaults live in pyproject.toml. Flower supplies the internal FLWR_RUNTIME_BASE_URL and FLWR_RUNTIME_API_KEY variables automatically.

Troubleshooting

  • /v1/responses returns 404: upgrade Ollama to 0.13.3 or newer.
  • Port 11434 refuses connections: start Ollama.
  • The model is missing: run ollama pull <model>.
  • Port 9093 refuses connections: start SuperLink and check the config above.

More detail is available in Flower's local SuperLink guide and Ollama's OpenAI compatibility documentation.