Patterns
Hooks Reference
Guardrails ACS / Hooks Reference

Appendix A β€” Full Supported Hooks Reference

#HookFires whenAOS methodTypical Guardian Agent use
1Agent TriggerAn external trigger (schedule, inbound message, webhook) activates the agent, before it starts reasoningsteps/agentTriggerBlock or rewrite spoofed/malicious triggers before the agent ever runs
2Tool Call RequestThe agent has decided to call a tool, before executionsteps/toolCallRequestDeny high-risk calls or rewrite parameters
3Tool Call ResultA tool call has completed, before the agent consumes the resultsteps/toolCallResultStrip sensitive data or block a poisoned/unexpected result
4User MessageAn inbound user prompt, before the agent processes itsteps/message (role=user)Filter injection attempts, jailbreaks, or out-of-scope requests
5Memory Context RetrievalPrior memory is pulled into context, before attachmentsteps/memoryContextRetrievalPrevent stale or poisoned memory from re-entering context
6Knowledge RetrievalData is pulled from a knowledge source (RAG, files), before reaching the LLMsteps/knowledgeRetrievalBlock or redact retrieved content that could indirectly inject the model
7Memory StoreThe agent is about to write to its memory storesteps/memoryStorePrevent persistence of attacker-supplied instructions or sensitive data
8Agent ResponseThe outbound response, before it reaches the usersteps/message (role=agent)Redact, block, or rewrite the final output
9MCP OutboundThe agent sends a message to a remote MCP serverprotocols/MCPRestrict outbound MCP traffic to an approved server list
10MCP InboundThe agent receives a message from a remote MCP serverprotocols/MCPScreen inbound MCP payloads before processing
11–15A2A hooks (send/stream message, cancel task, get task, get/set notification config, resubscribe)Task delegation, cancellation, and status exchange with peer agentsA2A protocol methodsAuthenticate and authorize inter-agent task handoffs; contain a compromised peer agent

Verdict Object Structure

Every hook returns a verdict object carrying the same response shape across all hooks, which is what makes a single Guardian Agent implementation able to enforce policy consistently across the entire agent lifecycle.

Verdict Fields

{
  "verdict": "allow | deny | modify",
  "reason": "Human-readable explanation of the decision",
  "modifiedRequest": {
    // Replacement content (only for modify verdict)
  }
}

Verdict Types

Allow

  • Effect: The action proceeds unchanged
  • Use when: The action passes all policy checks
  • Required fields: verdict: "allow", reason

Deny

  • Effect: The action is blocked entirely
  • Use when: The action violates policy and cannot be safely modified
  • Required fields: verdict: "deny", reason
  • Agent behavior: Agent should handle the denial gracefully (e.g., return safe refusal template)

Modify

  • Effect: The action proceeds, but with Guardian-Agent-supplied replacement content
  • Use when: The action can be made safe by modifying parameters or content
  • Required fields: verdict: "modify", reason, modifiedRequest
  • Agent behavior: Agent should use the modified content instead of the original

Hook Categories

Lifecycle Hooks (1, 8)

These hooks cover the beginning and end of the agent lifecycle:

  • Agent Trigger (#1) β€” Controls when and how an agent can be activated
  • Agent Response (#8) β€” Controls what the agent is allowed to output

Common use cases:

  • Prevent unauthorized agent activation
  • Filter malicious outbound content
  • Enforce response formatting and content policies

Tool Hooks (2, 3)

These hooks control tool usage, which is often the highest-risk agent capability:

  • Tool Call Request (#2) β€” Controls what tools the agent can call and with what parameters
  • Tool Call Result (#3) β€” Controls what tool results the agent can consume

Common use cases:

  • Prevent unauthorized tool usage
  • Parameter validation and sanitization
  • Result filtering and redaction
  • Cost control and rate limiting

Memory Hooks (5, 7)

These hooks control agent memory, a common attack vector:

  • Memory Context Retrieval (#5) β€” Controls what memory the agent can access
  • Memory Store (#7) β€” Controls what the agent can write to memory

Common use cases:

  • Prevent memory poisoning attacks
  • Control access to sensitive memory
  • Prevent persistence of malicious instructions
  • Implement memory retention policies

Knowledge Hooks (6)

These hooks control knowledge retrieval, another potential attack vector:

  • Knowledge Retrieval (#6) β€” Controls what knowledge sources the agent can access and what content it can retrieve

Common use cases:

  • Prevent access to unauthorized knowledge sources
  • Filter retrieved content for injection attacks
  • Implement knowledge source governance
  • Control RAG system access

Protocol Hooks (9, 10, 11-15)

These hooks control protocol-level interactions:

  • MCP Outbound (#9) β€” Controls connections to Model Context Protocol servers
  • MCP Inbound (#10) β€” Controls inbound MCP traffic
  • A2A hooks (#11-15) β€” Control inter-agent communication

Common use cases:

  • Implement allow-lists for MCP servers
  • Authenticate and authorize A2A communication
  • Prevent supply chain attacks through protocol connections
  • Control inter-agent task delegation

Hook Implementation Priority

Based on risk and implementation complexity, consider this priority order:

High Priority (Implement First)

  1. User Message (#4) β€” Basic input filtering, quick wins
  2. Agent Response (#8) β€” Basic output filtering, quick wins
  3. Tool Call Request (#2) β€” High-impact control point

Medium Priority (Implement Second)

  1. Tool Call Result (#3) β€” Important for data protection
  2. Memory Store (#7) β€” Important for preventing memory poisoning
  3. Memory Context Retrieval (#5) β€” Important for memory security

Lower Priority (Implement Later)

  1. Knowledge Retrieval (#6) β€” Important if using RAG systems
  2. Agent Trigger (#1) β€” Important for automated/triggered agents
  3. MCP Outbound (#9) β€” Important if using MCP servers
  4. MCP Inbound (#10) β€” Important if using MCP servers
  5. A2A hooks (#11-15) β€” Important for multi-agent systems

Hook Context Requirements

Each hook requires specific context to be effective:

Minimal Context

All hooks should provide:

  • Session ID β€” For traceability and audit
  • Agent ID β€” For agent identification
  • Timestamp β€” For temporal analysis
  • Hook ID β€” For hook identification

Hook-Specific Context

Agent Trigger (#1)

  • Trigger type (schedule, webhook, message)
  • Trigger source
  • Trigger parameters

Tool Call Request (#2)

  • Tool name and identifier
  • Tool parameters
  • Agent reasoning for the call
  • Request timestamp

Tool Call Result (#3)

  • Tool name and identifier
  • Tool result data
  • Execution metadata (duration, status)
  • Result timestamp

User Message (#4)

  • Message content
  • User identifier
  • Message metadata (channel, format)
  • Input timestamp

Memory Context Retrieval (#5)

  • Memory keys being retrieved
  • Retrieval context
  • Memory store identifier

Knowledge Retrieval (#6)

  • Knowledge source identifier
  • Query parameters
  • Retrieved content preview
  • Knowledge source metadata

Memory Store (#7)

  • Memory key being written
  • Content being written
  • Write context and metadata
  • Memory store identifier

Agent Response (#8)

  • Response content
  • Intended recipient
  • Response metadata (format, channel)
  • Output timestamp

MCP Hooks (9, 10)

  • MCP server identifier
  • Message content
  • Protocol version
  • Connection metadata

A2A Hooks (11-15)

  • Source agent identifier
  • Target agent identifier
  • Message or task content
  • Protocol metadata

Error Handling

Hook Evaluation Failures

When Guardian Agent evaluation fails:

  • Default to deny β€” Fail-safe behavior for security-critical systems
  • Log the failure β€” Record the error for debugging and analysis
  • Alert operators β€” Notify security teams of evaluation failures
  • Implement fallback β€” Consider fallback policies for critical systems

Verdict Processing Failures

When an agent fails to handle a verdict:

  • Log the failure β€” Record the error for analysis
  • Implement retry logic β€” Retry with exponential backoff
  • Circuit breaker β€” Disable the agent if failures persist
  • Alert operators β€” Notify teams of persistent issues

Performance Considerations

Latency Budget

Hook evaluation must be fast to avoid impacting agent responsiveness:

  • Target latency: < 100ms for most hooks
  • Critical hooks: < 50ms for high-frequency hooks (user message, tool call)
  • Complex evaluations: Consider async processing for non-critical hooks

Caching Strategies

Improve performance through intelligent caching:

  • Policy caching β€” Cache compiled policies to avoid re-parsing
  • Context caching β€” Cache frequently accessed context data
  • Result caching β€” Cache evaluation results for identical inputs
  • Distributed caching β€” Use Redis or similar for multi-instance deployments

Throughput Optimization

Handle high-volume agent interactions:

  • Connection pooling β€” Reuse connections to Guardian Agent
  • Batch processing β€” Process multiple hooks in parallel where possible
  • Load balancing β€” Distribute load across multiple Guardian Agent instances
  • Rate limiting β€” Implement backpressure handling for overload situations

Key Takeaways

  1. 15 standard hooks β€” Cover the entire agent lifecycle from trigger to response
  2. Consistent verdict structure β€” Same response shape across all hooks enables unified Guardian Agent
  3. Three verdict types β€” Allow, deny, and modify provide flexible control
  4. Hook categories β€” Lifecycle, tool, memory, knowledge, and protocol hooks
  5. Prioritized implementation β€” Start with high-impact, low-complexity hooks
  6. Context requirements β€” Each hook needs specific context for effective evaluation
  7. Performance matters β€” Hook evaluation must be fast to avoid impacting agent responsiveness

Next Steps

  • Risk Control Mapping β€” condensed quick-reference for ASI to ACS mapping