Skip to main content

meadows-bot

MEADOWS bot SDK: BaseBot, LLMBot, and ready-to-use bots. Bot-author-facing package with a fast quick-start. Depends on meadows-client (transport) and meadows-protocol (shapes). Never imports from meadows-server.

What this package contains

  • base.pyBaseBot: the SDK core. Auth, reconnect, registration, routing are hidden.
  • llm.pyLLMBot: minimal abstract LLM bot (no provider specifics in the PoC).
  • examples/echo_bot.py — the canonical example bot.
  • Ready-to-use bots (lazy-loaded via from meadows.bot import HelpBot, etc.):
    • help_bot.py — static help text (help, bots, commands, groups, guide)
    • stats_bot.py — passive monitoring dashboard (@stats, @stats reset)
    • chat_bot.py — LLM conversational assistant via Ollama
    • fetch_bot.py — fetches URLs and converts to Markdown
    • export_bot.py — exports a thread to a Markdown file
    • rag_bot.py — video/audio fragment search via RAG API
    • slo_bot.py — Dutch SLO curriculum learning outcome search

Quick start

A working bot is BOT_NAME + should_handle + handle + connect(). That's the whole contract.

Set the MEADOWS_JWT_TOKEN env var (generate with cd meadows-server && inv bot-jwt --name=mybot --expiry=1y), then:

from meadows.bot import BaseBot


class MyBot(BaseBot):
    BOT_NAME = "mybot"
    BOT_DESCRIPTION = "My custom bot"
    BOT_COMMANDS = [{"name": "greet", "description": "Say hello"}]

    def should_handle(self, command, args):
        return command == "greet"

    def handle(self, command, args, raw_args, message, thread_context):
        return f"Hello {args[0] if args else 'user'}!"


if __name__ == "__main__":
    MyBot().connect()

Install

cd meadows-bot
uv pip install -e .

# With extra bots that need HTTP dependencies
uv pip install -e ".[examples,dependency-heavy,llm]"

Test

uv run pytest -q

Included bots

Production bots (lazy-loaded via from meadows.bot import HelpBot)

Bot Commands Deps Description
HelpBot help, bots, commands, groups, guide none Static help text
StatsBot @stats, @stats reset, @stats groups, @stats top, @stats help none Passive monitoring dashboard; observes all traffic
ChatBot chat, ask, vraag, praat [llm] LLM assistant via Ollama (requires OLLAMA_URL)
FetchBot fetch, haal [dependency-heavy] Fetches URLs → Markdown
ExportBot export, exporteer none Exports a thread to a Markdown file
RagBot rag, zoek none Video/audio fragment search via RAG API
SLOBot slo, leerdoel none Dutch SLO curriculum learning outcome search

Example bots (in examples/ directory)

Bot Description
EchoBot Canonical example bot — echoes messages back
SentimentBot Label producer: sentiment analysis on all messages
LabelListenerBot Label consumer: alerts on angry sentiment
EchoServiceBot Minimal RPC service (echo)
MathServiceBot RPC service (arithmetic)
RPCCallerBot Demonstrates RPC via labels
TodoBot CRUD demo using interactive forms

The protocol boundary

The system contracts what it itself must understand. What only bots and humans need to understand stays opaque.

This package imports from meadows.client (transport) and meadows.protocol (shapes), never from meadows.server. Server and bot meet only via the protocol declaration. If you find yourself wanting an import from meadows.server, something has gone wrong — that belongs in meadows.protocol or nowhere.

Bot-author surface

What How
Identity BOT_NAME, BOT_DESCRIPTION, BOT_COMMANDS, BOT_CONTEXT_LIMIT (class attrs)
Decide should_handle(command, args) -> bool (abstract)
Respond handle(command, args, raw_args, message, thread_context) -> str | None (abstract)
Start connect() — waits 3s for the server, then connects and blocks
Helpers log(), get_sender_info(), format_help_response(), extract_quoted_string()
Patterns register_pattern(), unregister_pattern(), on_pattern_matched() (decorator)
Labels register_label_subscription(), unregister_label_subscription(), on_label_assigned(), emit_label()
Forms send_form() — send interactive HTML forms, receive submissions via label subscriptions
RPC call_rpc(), emit_rpc_request(), emit_rpc_response(), on_rpc_response()
History fetch_messages()
Lifecycle hooks on_connect(), on_disconnect() (passthrough to client)

Defaults and errors are pedagogy

The target user is not a standard Python developer — it's a Dutch teacher (groep 6) working with an AI during a hackathon. Defaults that "just work" and errors in human language matter more than elegance. A bot that fails silently teaches nothing.

Download files

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

Source Distribution

meadows_bot-0.1.0.tar.gz (160.9 kB view details)

Uploaded Source

Built Distribution

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

meadows_bot-0.1.0-py3-none-any.whl (53.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: meadows_bot-0.1.0.tar.gz
  • Upload date:
  • Size: 160.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for meadows_bot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d55ed7d118ed35d94e6dcbdd0e9764c90815b99db847d7e29398911599e91810
MD5 ff41d00b2b7e06aa8f780686a517cf3e
BLAKE2b-256 992ba5cdbf7055f2d34380b60d36acf58fd00d38a490f56590bd4d092a3f19d9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: meadows_bot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for meadows_bot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8430dfe3b04a9aa7f41e388a30ef805d06f91719aaf73aaa0638a0cb8851857e
MD5 bda069f2974edff17046d2b0b6746730
BLAKE2b-256 0bc7611c154ec17932c089e2ee890a138157f4668b6d460d7ffa23f937ebdf5e

See more details on using hashes here.

Supported by

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