Skip to content

feat: emit chat_title, llm_call, and message audit events - #2476

Open
lulululu-debug wants to merge 1 commit into
the-open-agent:masterfrom
lulululu-debug:feat/audit-log-enrichment
Open

feat: emit chat_title, llm_call, and message audit events#2476
lulululu-debug wants to merge 1 commit into
the-open-agent:masterfrom
lulululu-debug:feat/audit-log-enrichment

Conversation

@lulululu-debug

Copy link
Copy Markdown
Contributor

Summary

Emit chat_title, llm_call, and message audit events from generateMessageAnswer, so an external reader (aiguard) can show a chat's title, its conversation text, and the LLM call behind each reply.

Changes

Add message events (Role "user"/"assistant", Text the message itself) for both the incoming question and the generated reply - the one declared exception to this log otherwise being metadata only
Add an llm_call event per answered message, filling a gap where every tool_call was already logged but the LLM call producing the reply wasn't
Add a chat_title event carrying chat.DisplayName, the same short label OpenAgent's own chat list shows, emitted right where NeedTitle is cleared
Add Title, Role, and Text as new Event fields; llm_call reuses the existing Model/ContentLength/DurationMs/Outcome fields, no new ones needed

An external reader of OpenAgent's audit log (aiguard's Sessions and
Records pages) had no way to show a chat's title, no per-message
record of an LLM call, or the actual question/answer text of a turn -
generateMessageAnswer resolved a title into chat.DisplayName and
answered every message without any of it reaching the log tool_call
events already went to. A companion aiguard PR reads these.

Three additions to audit.Event, each emitted once per turn from
generateMessageAnswer:

- "message" events (Role "user"/"assistant", Text the message itself)
  are the one deliberate exception to this log being metadata only -
  see the package doc - emitted for both the incoming question and the
  generated reply.
- "llm_call" fills in a gap: message_answer.go answered every message
  without an audit event for the LLM call that produced it, unlike
  every tool_call already logged.
- "chat_title" carries chat.DisplayName, the same short label
  OpenAgent's own chat list shows, right where NeedTitle is cleared -
  not the prompt or response text that produced it.

Title, Role and Text are new Event fields; the tool_call/session
fields already on Event cover llm_call's needs (Model, ContentLength,
DurationMs, Outcome) without adding any.
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.

1 participant