Skip to content

Add Action Registry logging example (audit trail for agents)#446

Open
mosamosa-ko wants to merge 1 commit intoGetBindu:mainfrom
mosamosa-ko:action-registry-log
Open

Add Action Registry logging example (audit trail for agents)#446
mosamosa-ko wants to merge 1 commit intoGetBindu:mainfrom
mosamosa-ko:action-registry-log

Conversation

@mosamosa-ko
Copy link
Copy Markdown

@mosamosa-ko mosamosa-ko commented Apr 11, 2026

Adds a small “Action Registry” example to the README to help users keep an append-only audit trail of agent actions (JSONL). Minimal, no runtime dependency change.

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem:
  • Why it matters:
  • What changed:
  • What did NOT change (scope boundary):

Change Type (select all that apply)

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Security hardening
  • Tests
  • Chore/infra

Scope (select all touched areas)

  • Server / API endpoints
  • Extensions (DID, x402, etc.)
  • Storage backends
  • Scheduler backends
  • Observability / monitoring
  • Authentication / authorization
  • CLI / utilities
  • Tests
  • Documentation
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #

User-Visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/credentials handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Database schema/migration changes? (Yes/No)
  • Authentication/authorization changes? (Yes/No)
  • If any Yes, explain risk + mitigation:

Verification

Environment

  • OS:
  • Python version:
  • Storage backend:
  • Scheduler backend:

Steps to Test

Expected Behavior

Actual Behavior

Evidence (attach at least one)

  • Failing test before + passing after
  • Test output / logs
  • Screenshot / recording
  • Performance metrics (if relevant)

Human Verification (required)

What you personally verified (not just CI):

  • Verified scenarios:
  • Edge cases checked:
  • What you did NOT verify:

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Database migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly:
  • Files/config to restore:
  • Known bad symptoms reviewers should watch for:

Risks and Mitigations

List only real risks for this PR. If none, write None.

  • Risk:
    • Mitigation:

Checklist

  • Tests pass (uv run pytest)
  • Pre-commit hooks pass (uv run pre-commit run --all-files)
  • Documentation updated (if needed)
  • Security impact assessed
  • Human verification completed
  • Backward compatibility considered

Summary by CodeRabbit

  • Documentation
    • Added "Audit Log (Action Registry)" section documenting agent action tracking in JSONL format, including event logging schema with user tracking, action types, and audit metadata.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 11, 2026

📝 Walkthrough

Walkthrough

The pull request adds a new documentation section to the README describing an "Audit Log (Action Registry)" feature. This section documents a minimal JSONL audit trail format for agent actions, includes a Python code example demonstrating the log_event() function with key fields, and references the action-registry PyPI project specification.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added "Audit Log (Action Registry)" section with JSONL audit trail format specification, Python usage example for log_event() function with fields (user_id, action_type, tool, target, decision, status, tags, metadata), and link to action-registry PyPI project.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 With whiskers twitched and nose held high,
An audit trail now catches my eye,
From actions logged in JSONL array,
A registry born to track the way,
The rabbit hops through documentation's grace!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete. While it includes the template structure, most required sections (Summary bullets, Change Type, Scope, Linked Issues, User-Visible Changes, Security Impact, Verification, Evidence, Human Verification, Compatibility, Failure Recovery, Risks, and Checklist) are empty or unchecked. Complete the template by filling in Summary bullets, selecting appropriate Change Type and Scope checkboxes, answering Security Impact questions, and providing verification details and evidence.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding an Action Registry logging example to demonstrate audit trail functionality for agents.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
README.md (2)

224-241: Expand documentation to explain parameters and usage.

The documentation is too minimal. Consider adding:

  • Parameter descriptions: What do user_id, action_type, tool, target, decision, status, tags, and metadata represent?
  • Output location: Where are the JSONL logs written? (file path, stdout, etc.)
  • Use cases: Why would users want to add audit logging to their agents?
  • Example output: Show what the JSONL format looks like
  • Required vs optional parameters: Which fields are mandatory?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 224 - 241, Expand the Audit Log section around the
log_event example: add a short description of each parameter used by the
log_event API (user_id, action_type, tool, target, decision, status, tags,
metadata) indicating data types and semantics, mark which are required vs
optional, specify where the JSONL output is written (e.g., file path or stdout
and how to configure it), add 2–3 brief example use cases for why agents should
enable audit logging, and include a concrete sample JSONL line showing the exact
JSON fields produced by log_event so readers can see expected output format;
reference the log_event function name and the “Audit Log (Action Registry)”
heading so maintainers can locate where to update the README.

243-243: Use standard markdown link formatting.

The URL is wrapped in backticks, which renders it as inline code rather than a clickable link.

✏️ Suggested formatting
-Spec: `https://pypi.org/project/action-registry/`
+**Spec**: [action-registry on PyPI](https://pypi.org/project/action-registry/)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` at line 243, Replace the inline code formatting around the URL in
the README "Spec: `https://pypi.org/project/action-registry/`" with a standard
Markdown link (e.g., use [action-registry on
PyPI](https://pypi.org/project/action-registry/) or the
<https://pypi.org/project/action-registry/> shorthand) so the URL is clickable;
update the "Spec:" line accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 228-241: The README example imports log_event but lacks
installation and integration guidance; update the README to include a clear
installation step (e.g., pip/uv add command) for the action-registry package,
add a short example showing where to call log_event within a Bindu agent handler
(reference the handler function, bindufy and Agent/agent.run usage)
demonstrating both "started" and "done" event calls, and clarify whether this
integration is optional or recommended and how log_event relates to Bindu's
workflow (audit/logging vs control flow).
- Around line 224-244: The "Audit Log (Action Registry)" block (header "Audit
Log (Action Registry)" and the example using log_event) is currently inserted
between Quick Start "Option 1: Manual Setup" and "Option 2: TypeScript Agent"
and breaks the numbered flow; move that entire section (header + code block +
spec link) to one of the suggested locations—preferably after all Quick Start
options (before "Core Features") or into a new "Integrations"/"Advanced Usage"
section or as a row in the "Core Features" table—then update the document's
TOC/numbering so the Quick Start options remain sequential and verify internal
anchors still work.

---

Nitpick comments:
In `@README.md`:
- Around line 224-241: Expand the Audit Log section around the log_event
example: add a short description of each parameter used by the log_event API
(user_id, action_type, tool, target, decision, status, tags, metadata)
indicating data types and semantics, mark which are required vs optional,
specify where the JSONL output is written (e.g., file path or stdout and how to
configure it), add 2–3 brief example use cases for why agents should enable
audit logging, and include a concrete sample JSONL line showing the exact JSON
fields produced by log_event so readers can see expected output format;
reference the log_event function name and the “Audit Log (Action Registry)”
heading so maintainers can locate where to update the README.
- Line 243: Replace the inline code formatting around the URL in the README
"Spec: `https://pypi.org/project/action-registry/`" with a standard Markdown
link (e.g., use [action-registry on
PyPI](https://pypi.org/project/action-registry/) or the
<https://pypi.org/project/action-registry/> shorthand) so the URL is clickable;
update the "Spec:" line accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c19b5ac-8cfe-4f9e-aa5a-67e005c09037

📥 Commits

Reviewing files that changed from the base of the PR and between 98cfad0 and ebda4c8.

📒 Files selected for processing (1)
  • README.md

Comment thread README.md
Comment on lines +224 to +244
## Audit Log (Action Registry)

Minimal audit trail for agent actions (JSONL).

```python
from action_registry import log_event

log_event(
user_id="demo",
action_type="bindu_run",
tool="bindu",
target="local",
decision="allow",
status="done",
tags=["audit"],
metadata={"agent": "research_agent"},
)
```

Spec: `https://pypi.org/project/action-registry/`

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Relocate section to avoid disrupting the Quick Start options flow.

This "Audit Log (Action Registry)" section is inserted between "Option 1: Manual Setup" and "Option 2: TypeScript Agent", breaking the numbered sequence of Quick Start options. This disrupts the document's structure and navigation flow.

Consider moving this section to one of these locations:

  • After all Quick Start options (after line 331, before the "Core Features" section)
  • As a new row in the "Core Features" table (line 485)
  • In a dedicated "Integrations" or "Advanced Usage" section
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 224 - 244, The "Audit Log (Action Registry)" block
(header "Audit Log (Action Registry)" and the example using log_event) is
currently inserted between Quick Start "Option 1: Manual Setup" and "Option 2:
TypeScript Agent" and breaks the numbered flow; move that entire section (header
+ code block + spec link) to one of the suggested locations—preferably after all
Quick Start options (before "Core Features") or into a new
"Integrations"/"Advanced Usage" section or as a row in the "Core Features"
table—then update the document's TOC/numbering so the Quick Start options remain
sequential and verify internal anchors still work.

Comment thread README.md
Comment on lines +228 to +241
```python
from action_registry import log_event

log_event(
user_id="demo",
action_type="bindu_run",
tool="bindu",
target="local",
decision="allow",
status="done",
tags=["audit"],
metadata={"agent": "research_agent"},
)
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add installation instructions and integration guidance.

The code example imports action_registry, but there are no installation instructions for this package. Users attempting to run this code will encounter an ImportError.

Additionally, the example doesn't show how to integrate this with Bindu agents. Consider:

  1. Adding installation instructions (e.g., uv add action-registry or pip install action-registry)
  2. Showing where to call log_event() within a Bindu agent handler
  3. Clarifying whether this is an optional integration or recommended practice
  4. Explaining the relationship between this and Bindu's workflow
📘 Example integration pattern
from bindu.penguin.bindufy import bindufy
from action_registry import log_event
from agno.agent import Agent

def handler(messages: list[dict[str, str]]):
    # Log the incoming action
    log_event(
        user_id="demo",
        action_type="bindu_run",
        tool="bindu",
        target="local",
        decision="allow",
        status="started",
        tags=["audit"],
        metadata={"agent": "research_agent", "message_count": len(messages)},
    )
    
    result = agent.run(input=messages)
    
    # Log completion
    log_event(
        user_id="demo",
        action_type="bindu_run",
        status="done",
        metadata={"agent": "research_agent"},
    )
    
    return result
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@README.md` around lines 228 - 241, The README example imports log_event but
lacks installation and integration guidance; update the README to include a
clear installation step (e.g., pip/uv add command) for the action-registry
package, add a short example showing where to call log_event within a Bindu
agent handler (reference the handler function, bindufy and Agent/agent.run
usage) demonstrating both "started" and "done" event calls, and clarify whether
this integration is optional or recommended and how log_event relates to Bindu's
workflow (audit/logging vs control flow).

@raahulrahl
Copy link
Copy Markdown
Contributor

this is incomplete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants