KSKS Security Research
Learning map / Session 1 / Scenes 12–13

FOUNDATION 06 · AGENCY

The loop creates agency.Stop conditions create control.

Understand the runtime loop around a model and the state, limits, validation, escalation, and termination rules that make it governable.

agent loopstatebudgetssafe failure
Learning guide
Level
Intermediate
Reading time
11 min
Presentation
Session 1
Progress
7 of 8

01 · Mental model

An agent is a model operating inside an application loop

The runtime supplies an objective and state, asks the model for the next step, validates any proposed action, executes approved tools, records the observation, and decides whether to continue. The model proposes; application code owns side effects.

A production loop needs iteration and token budgets, timeouts, tool allowlists, structured handoffs, retry policy, idempotency where relevant, and explicit states for complete, needs input, needs review, blocked, and failed safely.

02 · Visual explanation

01Planpropose next step
02Checkpolicy + schema
03Actexecute approved tool
04Observerecord result
05Stop?done, escalate, fail
The bounded agent loopEvery pass crosses a deterministic check before another action can occur.

03 · Compare and decide

Chat turn versus agent loop

Decision lensChat assistantBounded agent
ControlHuman drives each turnRuntime may choose another step
StateConversation contextTyped run state and artifacts
ToolsOptional and user-directedCore capability, scoped by node
CompletionResponse returnedExplicit done, review, blocked, or failed state

04 · Cybersecurity example

Read-only architecture assessment loop

The agent must collect design facts, identify gaps, and produce structured findings.

01

Plan one evidence request.

02

Validate it against the read-only allowlist.

03

Execute and record the result.

04

Stop at the evidence budget or escalate missing information.

Outcome: The loop can make progress without acquiring permission to change the environment.

05 · What to remember

The 60-second recall

01

Agency comes from the surrounding loop, not a personality.

02

Every side effect should cross deterministic authorization.

03

Safe termination is a first-class feature, not an error case.

Teach-back prompt: Explain this concept to a teammate using the diagram, then name one failure mode and the control that stops it.

06 · Questions people ask

FAQ

There is no universal number. Set the smallest budget that fits the task, then measure completion, retries, cost, and failure patterns.

07 · Primary sources

Continue with authoritative guidance