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.py — BaseBot: the SDK core. Auth, reconnect, registration, routing are hidden.
  • llm.py — LLMBot: 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.

Metadata

Release files for meadows-bot 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meadows-bot 0.1.0
File Size Uploaded
meadows_bot-0.1.0.tar.gz 160.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for meadows-bot 0.1.0
File Interpreter ABI Platform
meadows_bot-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 214.0 kB

Release files / meadows_bot-0.1.0.tar.gz

Download URL meadows_bot-0.1.0.tar.gz
Size 160.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d55ed7d118ed35d94e6dcbdd0e9764c90815b99db847d7e29398911599e91810
BLAKE2b-256 checksum
How to use checksums
992ba5cdbf7055f2d34380b60d36acf58fd00d38a490f56590bd4d092a3f19d9
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / meadows_bot-0.1.0-py3-none-any.whl

Download URL meadows_bot-0.1.0-py3-none-any.whl
Size 53.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8430dfe3b04a9aa7f41e388a30ef805d06f91719aaf73aaa0638a0cb8851857e
BLAKE2b-256 checksum
How to use checksums
0bc7611c154ec17932c089e2ee890a138157f4668b6d460d7ffa23f937ebdf5e
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page