aga_measure_behavior
Measure behavioral patterns or record tool invocations for AI agents through attestation and logging to a tamper-evident continuity chain.
Instructions
Measure behavioral patterns or record tool invocation. (NIST-2025-0035)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tool_name | No | Tool name to record/test | |
| record_only | No | If true, just record without measuring |
Implementation Reference
- src/tools/measure-behavior.ts:9-37 (handler)The handler function 'handleMeasureBehavior' for the tool 'aga_measure_behavior'. It records tool invocations and measures behavioral patterns using the behavioral monitor.
export async function handleMeasureBehavior(args: MeasureBehaviorArgs, ctx: ServerContext) { // If a tool_name is provided, record the invocation first if (args.tool_name) { ctx.behavioralMonitor.recordInvocation(args.tool_name, sha256Str(args.tool_name)); } // If record_only, just acknowledge the recording if (args.record_only) { return ctx.json({ success: true, recorded: args.tool_name, record_only: true, }); } // Measure behavioral patterns const measurement = ctx.behavioralMonitor.measure(); if (measurement.drift_detected) { await ctx.appendToChain('BEHAVIORAL_DRIFT', { violations: measurement.violations, behavioral_hash: measurement.behavioral_hash, }); } return ctx.json({ success: true, ...measurement, violation_count: measurement.violations.length, }); } - src/tools/measure-behavior.ts:4-7 (schema)Argument interface for the 'aga_measure_behavior' tool.
export interface MeasureBehaviorArgs { tool_name?: string; record_only?: boolean; } - src/server.ts:290-297 (registration)Registration of the 'aga_measure_behavior' tool in the MCP server.
server.tool('aga_measure_behavior', 'Measure behavioral patterns or record tool invocation. (NIST-2025-0035)', { tool_name: z.string().optional().describe('Tool name to record/test'), record_only: z.boolean().optional().describe('If true, just record without measuring'), }, async (args) => handleMeasureBehavior(args, ctx), );