agent-guard

v0.1.3
io.github.mdfifty50-boop/agent-guard Checked 2 days ago Published 7 months ago

Constitutional guardrails and loop detection for AI agents

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

register_agent

Register an agent for loop monitoring. Configure iteration limits and progress thresholds.

ParameterTypeDescription
agent_id *stringUnique identifier for the agent
max_iterationsintegerMaximum iterations before forced stop (default 100)
progress_thresholdnumberMinimum ratio of unique/total actions to consider "making progress" (default 0.3)

log_action

Log an agent action for loop detection. Maintains a rolling window of the last 50 actions and returns early warnings.

ParameterTypeDescription
agent_id *stringAgent identifier
args *objectArguments passed to the tool
tool_name *stringName of the tool being called
result_previewstringBrief preview of the result (max 200 chars)

detect_loop

Check if an agent is stuck in an infinite loop. Analyzes action patterns, uniqueness ratio, and repeated signatures.

ParameterTypeDescription
agent_id *stringAgent identifier to check

set_circuit_breaker

Configure a circuit breaker to auto-terminate or warn when an action pattern repeats too many times.

ParameterTypeDescription
agent_id *stringAgent identifier
actionstringWhat to do when triggered: warn (allow but warn), block (prevent execution), suggest_alternative (allow but suggest different approach)
max_repeatsintegerMaximum times an identical action can repeat before triggering (default 3)

check_circuit_breaker

Check if a proposed action should be allowed or blocked by the circuit breaker. Call this BEFORE executing a tool.

ParameterTypeDescription
agent_id *stringAgent identifier
proposed_args *objectArguments the agent wants to pass
proposed_tool *stringTool name the agent wants to call

get_stuck_report

Get a detailed analysis of why an agent is stuck, including action history, patterns, token waste estimate, and recovery recommendations.

ParameterTypeDescription
agent_id *stringAgent identifier to analyze

get_health_dashboard

Get an overview of all monitored agents with their current loop risk scores and status.