Skip to content

[Example] Add policy hot-reload demo #25

@Acacian

Description

@Acacian

What

Add an example script (examples/hot_reload_demo.py) demonstrating policy hot-reload and policy merge.

Why

runtime.update_policy() and Policy.from_yaml_files() were added in v0.1.3 but lack a standalone example. These features are important for production deployments where policies change without restarts.

Expected behavior

  1. Start with a permissive policy (auto-approve reads)
  2. Execute some actions
  3. Hot-reload a stricter policy (block deletes)
  4. Show the same actions now get blocked
  5. Demonstrate Policy.from_yaml_files() for merging base + override policies

Acceptance criteria

  • examples/hot_reload_demo.py runs without errors
  • Demonstrates runtime.update_policy()
  • Demonstrates Policy.from_yaml_files() or policy.merge()
  • Added to examples/README.md

Difficulty

Beginner — straightforward API usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions