Kind: Class
Source: atloria-monorepo/libs/agent-core/src/autonomous/autonomous-loop.ts
TurnHook that drives autonomous agent behavior.
It watches what the agent is doing (via tool calls in input items) and injects nudges when the agent skips investigation or verification.
Usage:
typescriptconst hook = new AutonomousTurnHook({
maxTurns: 40,
qualityGateProvider: async () => [
{ id: 'tests_pass', description: 'All tests pass', passed: false },
],
});
Implements: TurnHook
Methods
| Method | Signature | Returns |
|---|---|---|
updateTokenUsage | updateTokenUsage(inputTokens: number) | void |
getCircleDetector | getCircleDetector() | `CircleDetector |
beforeModelCall | beforeModelCall(args: TurnHookArgs<TContext>) | Promise<{ instructions?: string; input?: AgentInputItem[] }> |
getState | getState() | Readonly<LoopState> |
getRecentFiles | getRecentFiles() | readonly string[] |
Properties
| Property | Type |
|---|---|
onPreCompact | (data: { turnNumber: number; tokenCount: number; recentFiles: string[] }) => void |
onPostCompact | (data: { turnNumber: number; summaryInjected: boolean }) => void |
Where it refuses work
AutonomousTurnHookstops the work with an early return whennudges.length === 0 && !notesBlock && !windowedInput && !phaseDirective.
When something fails
AutonomousTurnHookhandles failure in 8 places: it discards it silently in 7, and logs it and continues in 1.
Was this page helpful?