Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Architect’s View on GenAI with Spring AI and La...

Architect’s View on GenAI with Spring AI and LangChain4j - Javeloper 2026

Generative AI is taking the world by storm. While some use cases may seem questionable, many systems can genuinely benefit from GenAI. While most attention still focuses on advancing GenAI capabilities, integration with new and existing enterprise-grade systems often gets overlooked.

This talk presents a software architect's perspective on incorporating various GenAI models into your applications. We'll examine key quality attributes (such as portability, maintainability, security, and extensibility) while comparing two popular JVM solutions - Spring AI and LangChain4j. All of that will be illustrated with real-life stories and examples.

Join me as we seek answers to critical questions:
- How has the GenAI landscape evolved over last years?
- Are GenAI solutions ready for enterprise-grade systems without keeping architects up at night?
- Has a clear leader emerged among AI frameworks?
- Has the industry finally addressed security, performance, and testability concerns?

Avatar for Piotr Łaskawiec

Piotr Łaskawiec

May 14, 2026

More Decks by Piotr Łaskawiec

Other Decks in Programming

Transcript

  1. „Describe me in 5 concise bullet points” Prompt: • Pragmatic

    Software Architect • Creating software for nearly 20 years • Founder of • Helping companies to deliver real value • Occasional speaker and trainer Gener a ted by AI @piotrl a sk a wiec @piotrl a sk a wiec.bsky.soci a l COMSENITY
  2. *This chart is de fi nitely not scienti fi c…

    Hype over time Hype Time NoSQL Microservices Blockchain AI Tool/Language XYZ Event Horizon COMSENITY
  3. Under 1 minute… GenAI/LLMs • Cre a tes new content

    - text, im a ges, code, a udio, video - b a sed on p a tterns le a rned from l a rge d a t a sets. • LLMs a re tr a ined speci f ic a lly on l a ngu a ge d a t a to underst a nd a nd gener a te hum a n- like text. • LLMs use billions of p a r a meters to predict a nd gener a te coherent, context- a w a re text outputs. • Tr a nsformer Architecture (token prediction). Arti f ici a l Inteligence Arti f ici a l Intelligence M a chine Le a rning Deep Le a rning Gener a tive AI Im a ge/Video LLM COMSENITY
  4. Completion REST API Prompt Roles User/System Not st a nd

    a rdized St a teless Ch a t Memory Structured Output Pre-tr a ined System Inter a ctions Context D a t a V a rious Input Types V a rious Output Types Request/Response Stre a ming Fr a mework Integr a tion Observ a bility Test a bility COMSENITY
  5. Common parts • Simil a r concepts a nd a

    bstr a ctions • Multiple LLM providers supported • Support for multimod a lity • Prompt templ a tes • Response stre a ming • Structured outputs • Ch a t memory • RAG (Retriev a l-Augmented-Gener a tion) • Multiple Vector Stores supported COMSENITY
  6. • From pre- f in a l in M a

    y 2025 to st a ble 1.1.6, Spring AI 2.0.0 M6 a lre a dy a v a il a ble • Deep integr a tion with Spring ecosystem • Out-of-the-box support for building MCP servers • B a sic a gent orchestr a tion • Spring AI Community GitHub org a niz a tion • Skills, gu a rdr a ils (vi a a dvisors) LangChain4j COMSENITY • From pre- f in a l in M a y 2025 to st a ble 1.14.1 • Spring Boot, Qu a rkus, Helidon integr a tions • Focused on MCP client-side, possible e.g. vi a Qu a rkus MCP Server • More a dv a nced a gent orchestr a tion (e.g. sh a red memory) • L a ngCh a in4j Community • Skills, gu a rdr a ils, E a syRAG
  7. Context is everything Prompt Stu ff ing RAG Tool C

    a lling Embeddings Vector Stores Ingestion COMSENITY
  8. Tool Calling Applic a tion bound a ry Service A

    Service B Extern a l Model Extern a l Service D a t a source COMSENITY
  9. Tool Calling Applic a tion bound a ry Service A

    Service B Extern a l Model Extern a l Service D a t a source COMSENITY
  10. • Don a ted to the Agentic AI Found a

    tion (hosted by the Linux Found a tion) • ~9400 public MCP servers a s of April 2026 (~1200 in Q1 2025) • 78% of enterprise AI te a ms report a t le a st one MCP-b a cked a gent in production • 41% of enterprise AI te a ms h a ve a t le a st one custom intern a l MCP server • MCP Register, MCP Bundles, MCP Apps… • 2 m a jor spec revisions since M a y 2025 (June a nd November 2025) • Structure tool output • Elicit a tion • OAuth overh a ul (MCP servers a re now OAuth Resource Servers) + OpenID Connect Discovery • T a sks (still experiment a l) COMSENITY Source of st a ts: https://www.digit a l a pplied.com/blog/mcp- a doption-st a tistics-2026-model-context-protocol
  11. • C a p a bilities • Resources - generic

    text/bin a ry d a t a ( f ile content, API responses, UI etc.) • Tools - execut a ble function a lities • Prompts - reus a ble templ a tes for users • Elicit a tion (new) - servers c a n p a use a nd a sk the user for missing input mid-c a ll • T a sks (new) - c a ll now, fetch l a ter - a sync h a ndles for long-running server work • S a mpling - f lips the f low - MCP server a sks the client's LLM for a completion, with the hum a n in the loop • Tr a nsports • Stdio • Stre a m a ble HTTP (new) • HTTP/SSE (leg a cy) • D a t a form a t - JSON-RPC 2.0 COMSENITY
  12. Let LLM do the job Agentic AI • AI Agent

    - softw a re system th a t use AI to pursue go a ls a nd complete t a sks on beh a lf of users. • Agentic System Architectures: • Work f low - LLMs a nd Tools a re progr a mm a tic a lly orchestr a ted (well-de f ined control f low) • P a tterns: sequenti a l, loop, p a r a llel, condition a l • Agents - LLMs fully control the f low • LLM is responsible for choosing how to solve a given problem using a v a il a ble tools. • There a re no gu a r a ntees reg a rding the control f low. • Tools c a n be c a lled 0-N times. COMSENITY
  13. Quality attributes • Security • Test a bility • Correctness

    • Perform a nce • Observ a bility COMSENITY
  14. Security • Att a cks • Prompt Injection • Prompt

    Le a king • J a ilbre a king • DoS • Defense is in your h a nds • Gu a rdr a ils
  15. Access to Sensitive Data Exposure to Untrusted Content Ability to

    Externally Communicate Vulnerability Lethal Trifecta COMSENITY
  16. Performance • Perform a nce-Oriented Prompt Engineering (sic!) • SLAs

    in non-deterministic world m a y be h a rd to re a ch • Lot of moving p a rts
  17. Testability • Simple checks • All required inform a tion

    provided in the a nswer • Proper tools were invoked • Token counts • How to test something th a t is inherently not deterministic? • M a ke it more deterministic • Fight f ire with f ire - AI Model Ev a lu a tion - LLM- a s- a -Judge
  18. Correctness • H a llucin a tions • Writing a

    good prompt is a n a rt • Provide qu a lity context to the model • Retries • Rollb a cks (Compens a ting Actions) • HITL (Hum a n in the Loop)
  19. Observability • Support for metrics a nd tr a ces

    (Sem a ntic Tr a ces) • Follows OTel „Sem a ntic conventions for gener a tive AI systems” (still in development)