Apache Flink 2.2 for AI Conversation Analytics: ML_PREDICT, VECTOR_SEARCH, and Real Use Cases (2026)
By Sagar Shankaran, Founder of CallSphere
Flink 2.2 adds ML_PREDICT and VECTOR_SEARCH SQL functions, baking remote LLM inference into stream processing. We show how to enrich a call event stream with sentiment, topic, and embeddings — all in one Flink job.
Key takeaways
TL;DR — Flink 2.2 (Dec 2025) ushered in the AI era for stream processing:
ML_PREDICTcalls remote LLMs as a SQL function,VECTOR_SEARCHdoes similarity search inline, and Confluent Cloud Managed Flink scales it without ops. CallSphere uses a single Flink job to enrich call events with sentiment + intent + embedding before they hit ClickHouse.
Why this pipeline
Stream-then-enrich-then-store is a classic pattern. Pre-2026 you needed a Python service in the middle calling OpenAI. Flink 2.2 collapses that into SQL: SELECT call_id, ML_PREDICT('gpt-4o-mini', transcript) AS sentiment FROM stream. One job, one operator graph, one set of metrics.
The other 2026 win is VECTOR_SEARCH — embedding lookup against a vector store directly inside the Flink job, so you can do "did this caller ask the same question last week?" inline.
Architecture
flowchart LR
Kafka[(Kafka<br/>call.transcript)] --> Flink[Flink 2.2 job]
Flink -->|ML_PREDICT gpt-4o-mini| LLM[(OpenAI / Bedrock)]
Flink -->|VECTOR_SEARCH| VS[(Vector store)]
Flink -->|enriched| Out[(Kafka<br/>call.enriched)]
Out --> CH[(ClickHouse)]
Out --> Ice[(Iceberg lake)]
A single Flink SQL job pulls from call.transcript, calls the LLM and vector store, and writes call.enriched for downstream sinks.
CallSphere implementation
Explore a live demo and compare current plans to find the right fit for your business.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
Build steps with code
- Deploy Flink 2.2 (or use Confluent Cloud / Ververica).
- Register an OpenAI model resource in the Flink catalog.
- Register a vector store (pgvector, Qdrant, or Pinecone) as a model resource.
- Create the SQL job that enriches the stream.
- Test backpressure — LLM calls are slow; use
async i/ooperators with a 100-call queue. - Set keyed state TTL to bound memory.
- Run a daily DAG check for stuck operators.
CREATE MODEL gpt_4o_mini
INPUT (transcript STRING)
OUTPUT (sentiment FLOAT, intent STRING, lead_score INT)
WITH (
'provider' = 'openai',
'task' = 'classification',
'model' = 'gpt-4o-mini',
'system_prompt' = 'Score sentiment in [-1,1], detect intent enum, lead score 0-100. JSON.'
);
INSERT INTO call_enriched
SELECT
c.call_id,
c.vertical,
p.sentiment,
p.intent,
p.lead_score
FROM call_transcript AS c,
LATERAL TABLE(ML_PREDICT(MODEL gpt_4o_mini, c.transcript)) AS p;
Pitfalls
- Synchronous LLM calls — single job back-pressure on slow API; use async i/o.
- Unbounded state — set TTL on keyed state.
- No model versioning — pin the model version so reruns are reproducible.
- Skipping the dead-letter — when the LLM 429s, route the row to a DLQ topic.
- Writing raw transcripts to LLM — redact PII first (post #6).
FAQ
Flink vs. RisingWave? Flink is more general (Java/Python UDFs, complex event processing); RisingWave is SQL-first with simpler ops. For AI enrichment specifically, Flink 2.2's ML_PREDICT is the cleanest API.
Latency? With async i/o and a 200-row buffer, end-to-end is ~600 ms — fine for analytics, too slow for in-call decisions.
Cost? Confluent Cloud Managed Flink charges per CFU; ML_PREDICT cost is the LLM API call.
Exactly-once? Flink's exactly-once guarantees apply to sink writes; LLM side effects are at-least-once.
Self-host? Yes — Flink Helm chart works; budget for a 3-JM cluster.
Sources
- Apache Flink 2.2.0 Release (Flink Blog)
- Real-Time AI With Flink Model Inference (The New Stack)
- Top Streaming Trends 2026 (Kai Waehner)
- Confluent: Flink for Realtime AI
- Flink From Real-Time Data to Real-Time AI (Alibaba)
Apache Flink 2.2 for AI Conversation Analytics: ML_PREDICT, VECTOR_SEARCH, and Real Use Cases (2026): production view
Apache Flink 2.2 for AI Conversation Analytics: ML_PREDICT, VECTOR_SEARCH, and Real Use Cases (2026) forces a tension most teams underestimate: agent handoff state. A single LLM call is easy. A booking agent that hands a confirmed slot to a billing agent that hands a follow-up to an escalation agent — that's where context loss, hallucinated IDs, and double-bookings live. Solving it well means treating the conversation as a stateful workflow, not a chat.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Serving stack tradeoffs
The big fork is managed (OpenAI Realtime, ElevenLabs Conversational AI) versus self-hosted on GPUs you operate. Managed wins on cold-start, model freshness, and zero-ops; self-hosted wins on unit economics past a certain conversation volume and on data residency for regulated verticals. CallSphere runs hybrid: Realtime for live calls, self-hosted Whisper + a hosted LLM for async, both routed through a Go gateway that enforces per-tenant rate limits.
Latency budgets are non-negotiable on voice. End-to-end target is sub-800ms ASR-to-first-token and sub-1.4s first-audio-out; anything beyond that and turn-taking feels stilted. GPU residency in the same region as your TURN servers matters more than choosing a slightly bigger model.
Observability is the unglamorous backbone — every conversation produces logs, traces, sentiment scoring, and cost attribution piped to a per-tenant dashboard. HIPAA aligned isolation keeps healthcare traffic separated from salon traffic at the storage layer, not just the API.
FAQ
How does this apply to a CallSphere pilot specifically?
Real Estate runs as a 6-container pod (frontend, gateway, ai-worker, voice-server, NATS event bus, Redis) backed by Postgres realestate_voice with row-level security so multi-tenant data never crosses tenants. For a topic like "Apache Flink 2.2 for AI Conversation Analytics: ML_PREDICT, VECTOR_SEARCH, and Real Use Cases (2026)", that means you're not starting from scratch — you're configuring an agent template that's already been hardened across thousands of conversations.
What does the typical first-week implementation look like? Day one is integration mapping (scheduler, CRM, messaging) and prompt tuning against your top 20 real call transcripts. Day two through five is shadow-mode running, where the agent transcribes and recommends but a human still answers, so you can compare side-by-side. Go-live is the moment your eval pass-rate clears your internal bar.
Where does this break down at scale? The honest answer: it scales until your tool catalog gets stale. The agent is only as good as the integrations it can actually call, so the operational discipline is keeping schemas, webhooks, and fallback paths green. The platform handles the rest — observability, retries, multi-region routing — without your team owning the GPU layer.
Talk to us
Explore a live demo and compare current plans to find the right fit for your business.

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
Try CallSphere AI Voice Agents
See how AI voice agents work for your industry. Live demo available -- no signup required.