Skip to content

Python SDK

The Python SDK provides helpers for reading the overseer context and applying consistent terminal styling.

PyPI

Source: sdk/python/

Install

bash
pip install overseer-sdk

Reading context

python
from overseer_sdk import PluginContext

ctx = PluginContext.from_env()

print(ctx.version)      # overseer version string
print(ctx.config_path)  # path to merged config file

# Retrieve a resolved secret declared in the sidecar manifest
token = ctx.secret("github.personal", "token")

PluginContext.from_env() reads and parses the OVERSEER_CONTEXT environment variable injected by overseer at runtime.

Styling

python
from overseer_sdk import section_header, warn_line, ok_line, error_line

# Section header
print(section_header("Deployments", "production"))
# → ▸ Deployments  ·  production

# Warning line
print(warn_line("auth", "token expired"))
# → ⚠  auth: token expired

Color tokens

TokenCodeColorUsage
STYLE_HEADER99PurpleSection titles (bold)
STYLE_ACCENT212PinkKeys, channels, usernames
STYLE_OK82GreenSuccess states (bold)
STYLE_WARN214AmberWarnings (bold)
STYLE_ERROR196RedErrors (bold)
STYLE_MUTED240Dark greyHints, empty state
STYLE_DIM245GreySecondary info
STYLE_NORMAL252LightBody text

All color codes use the xterm 256-color palette, which works in any modern terminal.

Hooks

Use run_main to wire up your plugin's daily and status hooks:

python
from overseer_sdk import PluginContext, StatusResult, run_main

def daily(ctx: PluginContext) -> str:
    token = ctx.secret("myservice", "token")
    return "▸ My Service\n  all good\n"

def status(ctx: PluginContext) -> list[StatusResult]:
    return [StatusResult(name="myservice", ok=True, message="connected")]

if __name__ == "__main__":
    run_main(daily_fn=daily, status_fn=status)

Example plugin

Make the file executable and name it overseer-myplugin, then drop it in brain/overseer/plugins/.

python
#!/usr/bin/env python3
from overseer_sdk import PluginContext, section_header

ctx = PluginContext.from_env()
print(section_header("My Plugin", ctx.version))
# ... your plugin logic