Skip to main content

EDON governance for OpenClaw/Clawdbot agents — govern every tool call your Telegram bot makes

Project description

edon-openclaw · PyPI Python License: MIT

EDON governance for OpenClaw/Clawdbot agents. Every tool call your Telegram bot makes is evaluated by EDON before it executes.

pip install edon-openclaw

Architecture

Telegram User
      ↓
Clawdbot / OpenClaw agent
      ↓
edon-openclaw  ← intercepts tool calls
      ↓
EDON Gateway evaluates the action
      ↓
ALLOW  → tool executes
BLOCK  → blocked, reason logged
HUMAN  → escalated for approval

Quickstart (2 minutes)

pip install edon-openclaw
export EDON_API_KEY=your-key
export EDON_AGENT_ID=clawdbot-agent

@governed_skill decorator

The fastest way to add governance to any Clawdbot skill:

from edon_openclaw import governed_skill
from edon.exceptions import EdonBlockedError

@governed_skill(action_type="email.send")
def send_email(to: str, subject: str, body: str) -> str:
    """Send an email — only runs if EDON allows it."""
    return smtp_send(to, subject, body)

@governed_skill(action_type="web.search")
def search_web(query: str) -> str:
    """Search the web — usually ALLOWED."""
    return brave_search(query)

@governed_skill(action_type="shell.exec")
def run_command(command: str) -> str:
    """Run a shell command — BLOCKED by default policy."""
    ...

# Works with async skills too
@governed_skill(action_type="calendar.write")
async def create_event(title: str, date: str) -> str:
    return await calendar_api.create(title, date)

Three integration patterns

1. @governed_skill — per-function

Best for decorating individual skill functions. One line per skill.

from edon_openclaw import governed_skill

@governed_skill(
    action_type="email.send",
    agent_id="my-bot",                  # optional, defaults to EDON_AGENT_ID
    raise_on_block=True,                # raise EdonBlockedError on BLOCK
)
def send_email(to: str, subject: str, body: str) -> str:
    return smtp_send(to, subject, body)

2. EdonOpenClawGuard — tool registries

Best when Clawdbot dispatches from a dict or list of tools.

from edon_openclaw import EdonOpenClawGuard

# Dict registry
TOOLS = {
    "send_email": send_email,
    "search_web": search_web,
    "create_event": create_event,
}

governed = EdonOpenClawGuard.wrap_tools(
    tools=TOOLS,
    api_key=os.environ["EDON_API_KEY"],
    agent_id="clawdbot-agent",
    raise_on_block=False,  # Return error string to LLM instead of raising
)

# Use exactly like before — governance is transparent
result = governed["send_email"](to="user@example.com", subject="Hi", body="...")

3. EdonClawdProxy — gateway-level

Best for governing at the dispatch layer, not per-function.

from edon_openclaw import EdonClawdProxy

proxy = EdonClawdProxy(
    api_key=os.environ["EDON_API_KEY"],
    agent_id="clawdbot-agent",
)

def dispatch(tool_name: str, **kwargs) -> str:
    tool_fn = TOOLS[tool_name]
    return proxy.execute(
        action_type=f"tool.{tool_name}",
        payload=kwargs,
        fn=tool_fn,
        fn_kwargs=kwargs,
    )

# Check without executing
verdict = proxy.check("tool.send_email", {"to": "user@example.com"})
print(verdict["decision"])  # "ALLOW" or "BLOCK"

Handling blocked actions

from edon.exceptions import EdonBlockedError, EdonEscalatedError

try:
    send_email(to="all@company.com", subject="Blast", body="...")
except EdonBlockedError as e:
    print(f"Blocked: {e.reason}")
    print(f"Code:    {e.reason_code}")    # e.g. "OUT_OF_SCOPE"
    print(f"Audit:   {e.action_id}")      # trace the decision
except EdonEscalatedError as e:
    print(f"Needs human approval: {e.question}")
    # Route e.question to your human-in-the-loop queue

Environment variables

EDON_API_KEY=your-key          # required
EDON_BASE_URL=https://...      # optional: self-hosted gateway URL
EDON_AGENT_ID=clawdbot-agent   # optional: default agent identifier

Self-hosting

Point at your own EDON gateway:

@governed_skill(
    action_type="email.send",
    api_key="your-token",
    base_url="http://localhost:8000",
)
def send_email(...):
    ...

Links


License

MIT © EDON Core

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

edon_openclaw-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

edon_openclaw-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: edon_openclaw-0.1.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for edon_openclaw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf61075eeb0512111d4135d9702e00a2fc0644b52748723d7ea151c95763c939
MD5 564f70502746ace3b5c3a273c746c8cc
BLAKE2b-256 183e6b7bcc0123273e6c46ea5375e1e95cf0c04725c2f7e69506ea8540523e92

See more details on using hashes here.

File details

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

File metadata

  • Download URL: edon_openclaw-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for edon_openclaw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e650322d366b31e30326afd08c469efab16bc9692503d8eab722102136ca7fe
MD5 eca1fc6cfaf5222b1bedf594f6f96538
BLAKE2b-256 2548dacc18f5405011aac9a744c51780d55d4a4bfaeaf23811cc39908d059630

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 Pingdom Monitoring Sentry Error logging StatusPage Status page