Skip to content

feat: add agent middleware hooks for LLM, tools, retriever, and memory with runtime wiring, tests, and examples#32

Merged
vinodvx merged 1 commit into
mainfrom
feat/hooks
Jun 26, 2026
Merged

feat: add agent middleware hooks for LLM, tools, retriever, and memory with runtime wiring, tests, and examples#32
vinodvx merged 1 commit into
mainfrom
feat/hooks

Conversation

@vinodvx

@vinodvx vinodvx commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Description

Adds agent middleware hooks across the execution lifecycle so applications can intercept and modify LLM calls, tool execution, retrieval, and memory operations via WithHooks.

  • Hook points: BeforeLLM / AfterLLM, BeforeTool / AfterTool, BeforeRetrieve / AfterRetrieve, BeforeMemoryLoad / AfterMemoryLoad, BeforeMemoryStore / AfterMemoryStore
  • Runtime: wired in internal/runtime/base for local and Temporal paths; hook groups fingerprinted for config drift detection
  • API: types in internal/hooks, re-exported from pkg/agent; WithHooks(name, AgentHooks) registers named groups
  • Example: examples/agent_with_hooks demonstrates PII scrubbing, retrieval filtering, and memory tenant checks
  • Docs: Hooks section in README + examples overview

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactor / chore

Related issues

Closes #18

Checklist

  • I have run make check
  • I have run task examples:all
  • I have run make tidy if I added or removed dependencies
  • Commit messages follow conventional commits (e.g. feat:, fix:, docs:)
  • I have added/updated tests for my changes
  • Documentation is updated if needed

@vinodvx vinodvx merged commit c071e53 into main Jun 26, 2026
4 checks passed
@vinodvx vinodvx deleted the feat/hooks branch June 26, 2026 00:40
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.

Feature: hooks for agent execution lifecycle

1 participant