Skip to content

feat(conditions): SHACKLE — budget-enforcing, loop-detecting termination condition#7879

Open
Fame510 wants to merge 1 commit into
microsoft:mainfrom
Fame510:feat/shackle-guard
Open

feat(conditions): SHACKLE — budget-enforcing, loop-detecting termination condition#7879
Fame510 wants to merge 1 commit into
microsoft:mainfrom
Fame510:feat/shackle-guard

Conversation

@Fame510

@Fame510 Fame510 commented Jun 23, 2026

Copy link
Copy Markdown

Summary

Adds ShackleGuard — a pre-execution circuit breaker as an AutoGen TerminationCondition.

Usage:

from autogen_agentchat.conditions import ShackleGuard

guard = ShackleGuard(budget=0.25, max_repeat_calls=3, timeout_seconds=300)
team.run(task, termination_condition=guard)

What it does

Monitors both ToolCallRequestEvent (before execution) and ToolCallExecutionEvent (after execution) across all agents in a team.

Guard layers:

  1. Budget enforcement — stops team when cumulative tool cost exceeds budget
  2. Loop detection — blocks repeated identical tool calls
  3. Error amplification — tightens repeat limits when 401/403/500/timeout detected
  4. Wall-clock timeout — caps session duration
  5. Circuit breaker — once tripped, raises TerminatedException

Motivation

Directly addresses #7770 — the $106K AWS disaster where an agent destroyed infrastructure because no pre-execution budget guard existed. This condition would have terminated the team at $0.25.

Fully implements the TerminationCondition and Component protocols — drop-in compatible with any AutoGen team.

Adds ShackleGuard — a pre-execution circuit breaker as an AutoGen
TerminationCondition. Monitors tool calls, enforces budgets, detects
runaway loops, and terminates the team when limits are exceeded.

Usage:
    guard = ShackleGuard(budget=0.25, max_repeat_calls=3)
    team.run(task, termination_condition=guard)

Related: microsoft#7770
@Fame510

Fame510 commented Jun 23, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Sovereign Logic"

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