diff --git a/api/src/main/java/org/apache/flink/agents/api/annotation/EmbeddingModelConnection.java b/api/src/main/java/org/apache/flink/agents/api/annotation/EmbeddingModelConnection.java
new file mode 100644
index 00000000..2b41d375
--- /dev/null
+++ b/api/src/main/java/org/apache/flink/agents/api/annotation/EmbeddingModelConnection.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.agents.api.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to mark a method that provides an embedding model connection resource descriptor.
+ *
+ *
Methods annotated with this annotation should return a {@link
+ * org.apache.flink.agents.api.resource.ResourceDescriptor} that describes how to configure and
+ * create an embedding model connection.
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EmbeddingModelConnection {}
diff --git a/api/src/main/java/org/apache/flink/agents/api/annotation/EmbeddingModelSetup.java b/api/src/main/java/org/apache/flink/agents/api/annotation/EmbeddingModelSetup.java
new file mode 100644
index 00000000..b5a5b9a6
--- /dev/null
+++ b/api/src/main/java/org/apache/flink/agents/api/annotation/EmbeddingModelSetup.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.agents.api.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to mark a method that provides an embedding model setup resource descriptor.
+ *
+ *
Methods annotated with this annotation should return a {@link
+ * org.apache.flink.agents.api.resource.ResourceDescriptor} that describes how to configure and
+ * create an embedding model setup.
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EmbeddingModelSetup {}
diff --git a/api/src/main/java/org/apache/flink/agents/api/embedding/model/BaseEmbeddingModelConnection.java b/api/src/main/java/org/apache/flink/agents/api/embedding/model/BaseEmbeddingModelConnection.java
new file mode 100644
index 00000000..35dd1394
--- /dev/null
+++ b/api/src/main/java/org/apache/flink/agents/api/embedding/model/BaseEmbeddingModelConnection.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.agents.api.embedding.model;
+
+import org.apache.flink.agents.api.resource.Resource;
+import org.apache.flink.agents.api.resource.ResourceDescriptor;
+import org.apache.flink.agents.api.resource.ResourceType;
+
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+/**
+ * Abstraction of embedding model connection.
+ *
+ *
Responsible for managing embedding model service connection configurations, such as Service
+ * address, API key, Connection timeout, Model name, Authentication information, etc.
+ *
+ *
This class follows the parameter pattern where additional configuration options can be passed
+ * through a Map<String, Object> parameters argument. Common parameters include:
+ *
+ *
+ *
model - The model name to use for embeddings
+ *
encoding_format - The format for encoding (e.g., "float", "base64")
+ *
timeout - Request timeout in milliseconds
+ *
batch_size - Maximum number of texts to process in a single request
+ *
+ */
+public abstract class BaseEmbeddingModelConnection extends Resource {
+
+ public BaseEmbeddingModelConnection(
+ ResourceDescriptor descriptor, BiFunction getResource) {
+ super(descriptor, getResource);
+ }
+
+ @Override
+ public ResourceType getResourceType() {
+ return ResourceType.EMBEDDING_MODEL_CONNECTION;
+ }
+
+ /**
+ * Generate embeddings for a single text input.
+ *
+ * @param text The input text to generate embeddings for
+ * @param parameters Additional parameters to configure the embedding request
+ * @return An array of floating-point values representing the text embeddings
+ */
+ public abstract float[] embed(String text, Map parameters);
+
+ /**
+ * Generate embeddings for multiple text inputs.
+ *
+ * @param texts The list of input texts to generate embeddings for
+ * @param parameters Additional parameters to configure the embedding request
+ * @return A list of arrays, each containing floating-point values representing the text
+ * embeddings
+ */
+ public abstract List embed(List texts, Map parameters);
+
+ /**
+ * Get the dimension of the embeddings produced by this model.
+ *
+ * @return The embedding dimension
+ */
+ public abstract int getEmbeddingDimension();
+}
diff --git a/api/src/main/java/org/apache/flink/agents/api/embedding/model/BaseEmbeddingModelSetup.java b/api/src/main/java/org/apache/flink/agents/api/embedding/model/BaseEmbeddingModelSetup.java
new file mode 100644
index 00000000..c367fd03
--- /dev/null
+++ b/api/src/main/java/org/apache/flink/agents/api/embedding/model/BaseEmbeddingModelSetup.java
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.agents.api.embedding.model;
+
+import org.apache.flink.agents.api.resource.Resource;
+import org.apache.flink.agents.api.resource.ResourceDescriptor;
+import org.apache.flink.agents.api.resource.ResourceType;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+/**
+ * Base class for embedding model setup configurations.
+ *
+ *
This class provides common setup functionality for embedding models, including connection
+ * management and model configuration.
+ */
+public abstract class BaseEmbeddingModelSetup extends Resource {
+ protected final String connection;
+ protected String model;
+
+ public BaseEmbeddingModelSetup(
+ ResourceDescriptor descriptor, BiFunction getResource) {
+ super(descriptor, getResource);
+ this.connection = descriptor.getArgument("connection");
+ this.model = descriptor.getArgument("model");
+ }
+
+ public abstract Map getParameters();
+
+ @Override
+ public ResourceType getResourceType() {
+ return ResourceType.EMBEDDING_MODEL;
+ }
+
+ /**
+ * Get the embedding model connection.
+ *
+ * @return The embedding model connection instance
+ */
+ public BaseEmbeddingModelConnection getConnection() {
+ return (BaseEmbeddingModelConnection)
+ getResource.apply(connection, ResourceType.EMBEDDING_MODEL_CONNECTION);
+ }
+
+ /**
+ * Get the model name.
+ *
+ * @return The model name
+ */
+ public String getModel() {
+ return model;
+ }
+
+ /**
+ * Generate embeddings for the given text.
+ *
+ * @param text The input text to generate embeddings for
+ * @return An array of floating-point values representing the text embeddings
+ */
+ public float[] embed(String text) {
+ return this.embed(text, Collections.emptyMap());
+ }
+
+ public float[] embed(String text, Map parameters) {
+ BaseEmbeddingModelConnection connection = getConnection();
+
+ Map params = this.getParameters();
+ params.putAll(parameters);
+
+ return connection.embed(text, params);
+ }
+
+ /**
+ * Generate embeddings for multiple texts.
+ *
+ * @param texts The list of input texts to generate embeddings for
+ * @return A list of arrays, each containing floating-point values representing the text
+ * embeddings
+ */
+ public List embed(List texts) {
+ return this.embed(texts, Collections.emptyMap());
+ }
+
+ public List embed(List texts, Map parameters) {
+ BaseEmbeddingModelConnection connection = getConnection();
+
+ Map params = this.getParameters();
+ params.putAll(parameters);
+
+ return connection.embed(texts, params);
+ }
+
+ /**
+ * Get the dimension of the embeddings produced by this model.
+ *
+ * @return The embedding dimension
+ */
+ public int getEmbeddingDimension() {
+ return getConnection().getEmbeddingDimension();
+ }
+}
diff --git a/examples/pom.xml b/examples/pom.xml
index 1b8d543e..02407efc 100644
--- a/examples/pom.xml
+++ b/examples/pom.xml
@@ -69,7 +69,11 @@ under the License.
flink-agents-integrations-chat-models-ollama${project.version}
-
+
+ org.apache.flink
+ flink-agents-integrations-embedding-models-ollama
+ ${project.version}
+
\ No newline at end of file
diff --git a/examples/src/main/java/org/apache/flink/agents/examples/WorkflowEmbeddingsAgentExampleJob.java b/examples/src/main/java/org/apache/flink/agents/examples/WorkflowEmbeddingsAgentExampleJob.java
new file mode 100644
index 00000000..a94df5ff
--- /dev/null
+++ b/examples/src/main/java/org/apache/flink/agents/examples/WorkflowEmbeddingsAgentExampleJob.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flink.agents.examples;
+
+import org.apache.flink.agents.api.AgentsExecutionEnvironment;
+import org.apache.flink.agents.examples.agents.EmbeddingsAgent;
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.streaming.api.functions.source.SourceFunction;
+
+/**
+ * Example workflow demonstrating how to use the WorkflowEmbeddingsAgentExample to generate
+ * embeddings for streaming text data.
+ *
+ *
This example shows: 1. Setting up a Flink streaming job with the embedding agent 2. Processing
+ * text documents to generate vector embeddings 3. Handling both structured and unstructured text
+ * input 4. Monitoring embedding generation results
+ *
+ *
Prerequisites: - Ollama server running on localhost:11434 - nomic-embed-text model available:
+ * `ollama pull nomic-embed-text`
+ */
+public class WorkflowEmbeddingsAgentExampleJob {
+
+ /** Sample text documents for embedding generation. */
+ private static final String[] SAMPLE_DOCUMENTS = {
+ "Apache Flink is a framework and distributed processing engine for stateful computations over unbounded and bounded data streams.",
+ "Machine learning algorithms can learn patterns from data and make predictions on new, unseen data.",
+ "Vector embeddings capture semantic meaning of text in high-dimensional numerical representations.",
+ "Natural language processing enables computers to understand, interpret, and generate human language.",
+ "Deep learning uses neural networks with multiple layers to model and understand complex patterns.",
+ "Retrieval-Augmented Generation combines information retrieval with text generation for better AI responses.",
+ "Semantic search uses vector similarity to find relevant documents based on meaning rather than keywords.",
+ "Large language models are trained on vast amounts of text data to understand and generate human-like text.",
+ "Data streaming allows real-time processing of continuous data flows in distributed systems.",
+ "Artificial intelligence systems can process and analyze large volumes of data to extract insights."
+ };
+
+ /** Custom source function that generates sample text documents. */
+ public static class SampleTextSource implements SourceFunction {
+ private volatile boolean running = true;
+ private int documentIndex = 0;
+
+ @Override
+ public void run(SourceContext ctx) throws Exception {
+ while (running) {
+ // Send structured JSON documents
+ if (documentIndex < SAMPLE_DOCUMENTS.length) {
+ String document = SAMPLE_DOCUMENTS[documentIndex];
+ String jsonDoc =
+ String.format(
+ "{\"id\": \"doc_%d\", \"text\": \"%s\", \"category\": \"tech\", \"timestamp\": %d}",
+ documentIndex + 1,
+ document.replace("\"", "\\\""),
+ System.currentTimeMillis());
+ ctx.collect(jsonDoc);
+ documentIndex++;
+ } else {
+ // Send some plain text documents
+ String plainText =
+ "This is a plain text document number "
+ + (documentIndex - SAMPLE_DOCUMENTS.length + 1)
+ + " for embedding generation testing.";
+ ctx.collect(plainText);
+ documentIndex++;
+
+ if (documentIndex > SAMPLE_DOCUMENTS.length + 5) {
+ running = false; // Stop after processing all documents
+ }
+ }
+
+ // Wait 2 seconds between documents
+ Thread.sleep(2000);
+ }
+ }
+
+ @Override
+ public void cancel() {
+ running = false;
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ // Set up Flink execution environment
+ StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
+ env.setParallelism(1); // Use single parallelism for deterministic processing
+
+ // Set up Agents execution environment
+ AgentsExecutionEnvironment agentsEnv =
+ AgentsExecutionEnvironment.getExecutionEnvironment(env);
+
+ // Create data stream of text documents
+ DataStream textStream =
+ env.addSource(new SampleTextSource()).name("Sample Text Source");
+
+ // Process with embedding agent using the correct pattern
+ DataStream