Add Action Registry logging example (audit trail for agents)#446
Add Action Registry logging example (audit trail for agents)#446mosamosa-ko wants to merge 1 commit intoGetBindu:mainfrom
Conversation
📝 WalkthroughWalkthroughThe 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 Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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, andmetadatarepresent?- 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
| ## 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/` | ||
|
|
There was a problem hiding this comment.
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.
| ```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"}, | ||
| ) | ||
| ``` |
There was a problem hiding this comment.
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:
- Adding installation instructions (e.g.,
uv add action-registryorpip install action-registry) - Showing where to call
log_event()within a Bindu agent handler - Clarifying whether this is an optional integration or recommended practice
- 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).
|
this is incomplete. |
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:
Change Type (select all that apply)
Scope (select all touched areas)
Linked Issue/PR
User-Visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write
None.Security Impact (required)
Yes/No)Yes/No)Yes/No)Yes/No)Yes/No)Yes, explain risk + mitigation:Verification
Environment
Steps to Test
Expected Behavior
Actual Behavior
Evidence (attach at least one)
Human Verification (required)
What you personally verified (not just CI):
Compatibility / Migration
Yes/No)Yes/No)Yes/No)Failure Recovery (if this breaks)
Risks and Mitigations
List only real risks for this PR. If none, write
None.Checklist
uv run pytest)uv run pre-commit run --all-files)Summary by CodeRabbit