Skip to main content

Ollama Target adapter for Waken — routes waken Events to a local/self-hosted Ollama daemon.

Project description

waken-ollama

CI License: MIT

Ollama Target adapter for Waken — "nginx for AI agents." Routes a waken Event to a local or self-hosted Ollama daemon via the official ollama Python SDK and returns a Response.

Why Ollama fits here particularly well

Every other Target adapter in this ecosystem wraps a cloud API and needs an API key (ANTHROPIC_API_KEY, GEMINI_API_KEY, ...). Ollama needs none of that — it's a daemon that runs on hardware you already control, the same "no external services" idea behind Waken itself: waken keeps all its own state (sessions, scheduled jobs, the retry queue) in one local SQLite file instead of reaching for Docker, Redis, or Postgres. waken-ollama extends that same idea to the model itself — no cloud account, no billing, no secret to manage, just a local process talking to another local process.

Install

pip install waken-ollama

Prerequisite: Ollama must already be installed and running — either locally (ollama serve, or the desktop app, which starts it automatically) or as a self-hosted daemon reachable over the network — with the model you intend to use already pulled:

ollama pull llama3.2

This adapter only talks to an already-running daemon; it doesn't install Ollama, start it, or pull models on your behalf. If the daemon isn't reachable, calls raise a ConnectionError — that's a setup problem to fix on the machine running Waken, not something this adapter papers over.

Usage

from waken import Runtime
from waken_ollama import OllamaAdapter

runtime = Runtime()
runtime.target("ollama", OllamaAdapter(model="llama3.2"))
runtime.run()
waken send ollama "Build tic tac toe." --wait

By default OllamaAdapter talks to http://127.0.0.1:11434, or whatever OLLAMA_HOST is set to in the environment — the ollama SDK's own convention, read automatically. Point it at a remote/self-hosted daemon with host=:

runtime.target("ollama", OllamaAdapter(model="llama3.2", host="http://gpu-box:11434"))

Ollama's /api/chat endpoint has no server-side conversation state, unlike Claude's resume or OpenAI's previous_response_id — the full message history has to be resent on every call. OllamaAdapter keeps a waken session_id -> list of chat messages map internally and grows it in place across turns of the same event.session_id, so a multi-turn conversation picks up where it left off without the caller managing history itself. Extra keyword arguments passed to OllamaAdapter(...) are forwarded to ollama.AsyncClient(...).

Development

git clone https://github.com/WakenHQ/waken-ollama
cd waken-ollama
pip install -e ".[dev]"
pytest

Tests mock ollama.AsyncClient entirely — no local Ollama daemon or network access is needed to run the suite.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waken_ollama-0.1.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waken_ollama-0.1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file waken_ollama-0.1.0.tar.gz.

File metadata

  • Download URL: waken_ollama-0.1.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for waken_ollama-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1ab7d51bea573128d99582eaad56a7d97c550dec1d1bf68199c45de256ad5d26
MD5 69a0691c886cb6884aaa307122e00f5a
BLAKE2b-256 9f9e0ad733ef0239867e903cbbd1a4f4128c97ca57d5971098769d2f0b6742b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for waken_ollama-0.1.0.tar.gz:

Publisher: publish.yml on WakenHQ/waken-ollama

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file waken_ollama-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: waken_ollama-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for waken_ollama-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8d4e9d1f318cdc72cfa2b4d7cd4dd73b30e212016a39d93c6104ed0b53da5ac
MD5 f0b4f821784ec02f18524c1a70d48ab1
BLAKE2b-256 1a725af25a4ce71e2a7364c17f562670c7f998052906c57f009d96a2167b0ccf

See more details on using hashes here.

Provenance

The following attestation bundles were made for waken_ollama-0.1.0-py3-none-any.whl:

Publisher: publish.yml on WakenHQ/waken-ollama

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page