JDK 25 · Spring Boot 4.2 · Spring AI 2.1 · Spring AI Agent 0.8 · Spring Modulith

Guarded LLM factory with observability

It takes requirements in, screens them before any agent reads them, judges whether they are ready, and designs from a ready verdict. Every pass is written to a board you can read back, its memory lives on the stores you choose, and a second pass judges each one that stopped.

Now on Spring AI Agent 0.8. Every pass is a Spring AI Agent graph that saves a checkpoint after each node, the improvement pass's triage, draft and review are its subagents, and its A2A server lets another agent call the factory. What it runs and what it replaced

Read the book Take the course View on GitHub

The factory-springai mark: a factory whose chimney gives off a Spring leaf

Built on Spring AI Agent

The factory runs on Spring AI Agent 0.8.0, the experimental project on Spring AI 2.1 that puts a run around agents, walks graphs of typed nodes, resumes a run from its checkpoints and serves an agent over A2A.

What it runs

  • Each pass of a run, as a graph of the factory's steps, with the kill switch, the human gate and each step's limits around every node.
  • A checkpoint after each node, kept on the work's board, so a pass after a restart resumes after the last node that completed.
  • The improvement pass's triage, draft and review, as subagents that each see only their own request.
  • The A2A server, which makes a run a task another agent can send requirements to and get the design back from.

What it replaced

  • The run coordinator the factory had built for itself: RunCoordinator, ReadinessThenDesign, RunPolicy and NextStep.
  • The factory.runs.engine setting that chose between two engines.
  • ModelImprovementWorkflow, the improvement pass before its graph.

What stays the factory's

  • The route, read from the board after every node.
  • The board and its typed slices, the admission gates and consolidation.
  • The model router, the cost guard and the call guard.
  • The readiness guard and the context planner.

How the factory uses it · Each type it calls

What it does

  • The input screen

    Requirements and answers are screened before any agent reads them. A refusal escalates the run to a person and names what was found: prompt-injection, harmful-request or out-of-scope.

  • The judge inside the JVM

    Qwen3 8B decides whether requirements are ready to design. ModelJars runs it on the CPU through the JDK's Vector API, so it needs neither Ollama nor an API key.

  • Memory on your stores

    The board, contexts, long-term memory and context locks each choose a backend, from process memory and Postgres to Redis, MongoDB, DynamoDB, Cosmos DB and an Obsidian vault.

  • Messages and clouds

    Work arrives and status notices leave on Kafka, SQS and SNS, or Pub/Sub. Archives and secrets go to AWS or GCP, and Cloud Foundry runs it on GCP, Azure or AWS.

  • Governance

    Every run names an owner and a risk tier. The kill switch records a pass as terminated before its next model call, and a reviewer can overrule a refusal.

  • Observability

    Metrics at /actuator/prometheus, guardrail alert rules tested with promtool, and an admin UI that charts every series and alert.

  • The improvement pass

    A worker leases the recording of a stopped pass, triages it, drafts a change and reviews it. The change opens a pull request, or stays a local branch with its diff.

  • Tested on 15 stacks

    Every backend passes the shared contract suites, one end-to-end suite runs on 15 stacks, and the coverage gate holds every module to 100% of lines and branches.

One backend per component

Each component reads its own key first, then the shared key, then its default. A module under backends/ brings each technology, and the build packages the ones you choose.

Board, contexts, context locks
memoryPostgresRedis or ValkeyMongoDBDynamoDBCosmos DB
Long-term memory
memoryPostgresRedis or ValkeyMongoDBDynamoDBCosmos DBObsidian vault
Token spend
memoryRedisDynamoDBFirestore
Run messages
localKafkaSQS and SNSPub/Sub
Board events
Kafka
Run archive
localS3Cloud Storage
Secrets
localSecrets ManagerSecret Manager
Input screen
phrasesa model inside the JVM

Quick start

JDK 25 builds and runs it. This keeps every memory part in process memory, so nothing else needs to run. The two flags let the judge run inside the JVM, and its first call downloads about 5 GB of weights.

Run each configuration against Postgres, Redis, MongoDB and Kafka, or deploy it to Cloud Foundry.

mvn -B clean package -Pall-modules -DskipTests
java --add-modules=jdk.incubator.vector \
  --enable-native-access=ALL-UNNAMED \
  -jar factory-app/target/factory-app-*.jar \
  --spring.profiles.active=local