Skip to content

AgentCat v2.0.2 — event-level redact_event hook

Choose a tag to compare

@naji247 naji247 released this 08 Aug 16:52
· 2 commits to main since this release
v2.0.2
8846cf5

AgentCat now supports an event-level redact_event hook, matching the redactEvent/RedactEvent hooks already available in the TypeScript and Go SDKs — plus a round of hardening on top after an adversarial review of the new surface.

New: the redact_event hook

Runs before the string-level redact_sensitive_information hook and receives the full event (raw, unredacted values). Return a modified event, or None to drop it entirely:

from agentcat import AgentCatOptions

def redact_event(event):
    if event.resource_name == "get_credentials":
        return None
    if event.resource_name == "export_report":
        event.response = None
    return event

agentcat.track(server, "proj_0000000", AgentCatOptions(redact_event=redact_event))

Mutate and return the event you're handed — the return value replaces the event's fields wholesale, not as a diff, so returning a freshly-built or partial event will silently drop everything you didn't set.

server_name, server_version, client_name, and client_version — system-reported MCP metadata, not user content — are also now protected from redact_sensitive_information, so they always reach the dashboard intact.

Hardening

A system-managed field set (id, session_id, project_id, event_type, timestamp, actor identity, tags, properties, and client/server identity) is force-restored after the hook runs, so a hook can't forge or erase what AgentCat itself assigned — restored via a deep copy, so a hook holding a shared or cached dict can't corrupt another event by mutating it in place. The hook's typing is also tightened (RedactEventFunction, Event | None) so a return value that doesn't conform is a type-checker error rather than a silent runtime surprise.

Full Changelog: v2.0.1...v2.0.2