Skip to content
Everything Agents

Lesson 3 of 14 · 5 min

The mental model: four control surfaces

Topic boundaries, instructions, available-when gates, and after_reasoning. Knowing which to reach for first is the whole skill.

Agent Script gives you four orthogonal places to enforce behavior. Knowing which to reach for first is the whole skill.

The four control surfaces, stackedFour layers stacked from coarse to fine. Topic boundaries set the scope. Reasoning instructions guide the LLM. Available-when gates decide what tools the LLM sees. After-reasoning blocks compute derived state once an action runs.Topic / subagent boundarieswhich set of actions and instructions is activereasoning.instructions:the per-turn prompt the LLM seesavailable when ‹expr›which actions the LLM can even seeafter_reasoning:deterministic variable updates after an action runsCOARSELLM-drivenFINEdeterministicsoft above, hard below. Pick the lowest layer that gets the job done.
SurfaceWhat it controlsWhen to use
Topic / subagent boundariesWhich set of actions and instructions is "active"Coarse phase changes (verification then refund)
reasoning.instructions:What the LLM is told to do this turnSoft guidance, multi-step plans, polite phrasing
available when gatesWhich actions the LLM can even seeHard constraints (no refund without verification)
after_reasoning blocksVariable updates after an action runsCompute derived state from action outputs

Worked example

subagent identity_verification:
    actions:
        verify_customer:
            target: "apex://VerifyCustomer"   # backing action (truth source)

    reasoning:
        instructions: ->                       # prompt (LLM-driven)
            if @variables.customer_verified == False:
                | Ask for an email if you don't have one. Otherwise call verify.
        actions:
            verify: @actions.verify_customer
            go_refund: @utils.transition to @subagent.refund_processing
                available when @variables.customer_verified == True   # gate

    after_reasoning:                           # derived state
        if @variables.verified_flag == "true":
            set @variables.customer_verified = True

Each line uses a different surface. The LLM is in charge inside instructions: but cannot bypass available when or after_reasoning.

Quick check

The agent must never issue a refund without first verifying the customer. Where do you enforce this?