Reading tools and contents
Knowledge-Driven Agent Architectures

Chapter 2 of 10

Typed plans, preconditions, and action schemas

Formal planning

About 4 minutes · includes examples, an exercise, and references

Chapter at a glance

  • Action schemas turn free-form intentions into validated executable proposals.
  • Preconditions include fresh world state and authorization state.
  • Expected effects require observation and success predicates.

A plan is a proposed sequence or partial order of actions expected to transform an initial state into one satisfying a goal. Natural-language checklists are useful for people but ambiguous for execution. Typed plans make action names, arguments, preconditions, effects, risks, evidence needs, and success checks machine-readable. They let the system reject impossible or unauthorized steps before a tool call.

Classical planning formalisms such as PDDL separate a domain of action schemas from a problem containing initial facts and goals. PDDL2.1 extends this approach with durative actions and numeric quantities. A language-model agent need not implement a full planner to benefit from the discipline. Define predicates for relevant state, action schemas with required conditions, and effects that the controller expects to observe—not effects it merely assumes occurred.

Types constrain arguments. createChangeRequest may require a Service, Environment, and EvidenceBundle, while sendMessage requires a Channel and approved Recipient. Use stable entity identifiers rather than user-facing labels. Validate model output with JSON Schema or an equivalent typed interface. Enumerations should come from a tool registry or ontology release so the model cannot invent an action or scope.

Preconditions include world state and policy. A deployment proposal may require a passing build, approved change window, service ownership, and an authorized operator. Some conditions are static within the task; others must be read immediately before execution. Mark freshness. An approval checked yesterday may be stale when a write executes today.

Effects are hypotheses until verified. An API returning 202 Accepted proves request acceptance, not completion. The action schema should define an observation query and a success predicate. It should also define possible failure and ambiguous outcomes. If a timeout occurs after sending a request, retrying without an idempotency key can duplicate a write. The controller first queries status by request key.

Plans need causal links. If step 4 depends on evidence from step 2, encode that dependency and required output type. A directed acyclic plan can run independent reads concurrently while serializing risky actions. Dynamic replanning is allowed when observations invalidate assumptions, but the new plan is validated under the same policy and remaining budget.

Goal decomposition should preserve user intent. A subgoal includes its contribution to the parent goal, evidence of satisfaction, and constraints inherited from the task. The model may propose optional improvements, but the controller cannot expand scope into new external effects without authority. A request to analyze data does not imply permission to email findings or update the source.

Risk annotations support control. Classify actions as read, reversible write, irreversible write, communication, permission change, financial, or code execution. Map risk classes to approvals, sandboxes, rate limits, and evidence. Risk derives from tool plus arguments and environment: reading a public catalog differs from retrieving a private patient record with the same search interface.

Validate plans at three levels. Structural validation checks schema and known identifiers. Semantic validation checks types, preconditions, goal relevance, and dependency closure. Policy validation checks authority, data scope, budgets, and approval. Then simulate expected state changes where practical. Planning does not eliminate runtime checks because the environment can change between validation and execution.

Plan quality metrics include valid-step rate, precondition failure, unnecessary action count, parallelizable work, replans, irreversible actions avoided, cost estimate error, and verified goal completion. Prefer short plans with explicit evidence over elaborate prose that hides untestable assumptions.

Key points

  • Action schemas turn free-form intentions into validated executable proposals.
  • Preconditions include fresh world state and authorization state.
  • Expected effects require observation and success predicates.
  • Scope and constraints flow from parent goals into every subgoal.

A typed action contract

Read the expected behavior in the surrounding walkthrough, then copy and run this reference implementation.

A typed action contractjson
{
  "$id": "action/create-change-request/1",
  "type": "object",
  "required": ["serviceId", "environment", "evidenceIds", "idempotencyKey"],
  "properties": {
    "serviceId": {"type": "string", "pattern": "^service/"},
    "environment": {"enum": ["staging", "production"]},
    "evidenceIds": {"type": "array", "minItems": 1, "items": {"type": "string"}},
    "idempotencyKey": {"type": "string", "minLength": 16}
  },
  "additionalProperties": false
}

Worked examples

Toy

Accepted is not completed

A task API accepts a job and returns a request identifier.

The execute action transitions to pending. A separate observe action polls by identifier until success, failure, or timeout. Only a verified terminal response satisfies the goal.

  • Expected effect
  • Observation query
  • Ambiguous timeout

Application

Parallel evidence collection

A change proposal needs test results, dependency impact, and owner approval.

Independent read actions run concurrently. The write action depends on all three typed outputs and rechecks their freshness before submission.

  • Causal links
  • Freshness
  • Risk gate

Exercise

Compile a natural-language plan

Turn an informal five-step workflow into typed goals, actions, preconditions, effects, and observations.

  1. Create argument schemas and stable entity references.
  2. Mark causal dependencies and parallel reads.
  3. Add risk and approval policies.
  4. Simulate one stale precondition and one ambiguous outcome.

Success criteria

  • Unknown tools and fields fail closed.
  • Every effect has a verification method.
  • Replanning preserves scope and remaining budget.
  • A duplicate write cannot occur after a timeout.

Reflect: Which step sounded clear in prose but lacked enough state to execute safely?

References and further reading