Inference Foundrymodern AI systems fieldbook
Spring AI 2 · Grounded Agentic SystemsView Markdown source

Agents, workflows, planning, and bounded autonomy

An agent is a model-driven control loop that observes state, chooses an action, uses tools, evaluates progress, and stops. Many products called “agents” are better implemented as deterministic workflows with one or two model steps.

Agent loop

goal → observe → plan/select → tool → result → update state → stop/continue

Define maximum iterations, wall time, tokens, tool calls, cost, and retry limits. A stop condition is a product requirement.

Choose the simplest pattern

  • prompt/response for transformation;
  • fixed chain for known steps;
  • router for a small set of paths;
  • state machine for business workflow;
  • agent loop for genuinely open-ended tool choice;
  • human queue for judgment or authorization.

State

Persist explicit workflow state, not only a transcript. Record goal, plan, completed actions, tool inputs/outputs, approvals, evidence, budget, current status, and idempotency keys. Resume only after checking whether previous tools actually completed.

Planning

Plans are hypotheses. Replan after material evidence but prevent endless analysis. For simple tasks, planning overhead lowers reliability.

Reflection

Self-critique may improve output but adds another probabilistic call. Prefer external validators, executable tests, retrieval metrics, or deterministic business rules when available.

Spring AI implementation

Compose ChatClient, Advisors, tools, MCP callbacks, structured state, and application workflow code. Keep the domain state machine outside free-form model text.

Feynman check

An agent is a junior operator allowed to choose the next approved tool. A workflow is a checklist. Use the checklist whenever the job is known.

Inference FoundryIndependent study material · verify version details in official project documentation