GreatEugenius commented on code in PR #237:
URL: https://github.com/apache/flink-agents/pull/237#discussion_r2405097742


##########
docs/content/docs/operations/deployment.md:
##########
@@ -22,20 +22,181 @@ specific language governing permissions and limitations
 under the License.
 -->
 
+
+
+## Overall
+
+We provide a total of three ways to run the job: Local Run with Test Data, 
Local Run with Flink MiniCluster, and Run in Flink Cluster. The detailed 
differences are shown in the table below:
+
+<table class="configuration table table-bordered">
+    <thead>
+        <tr>
+            <th class="text-left" style="width: 30%">Deployment Mode</th>
+            <th class="text-left" style="width: 20%">Language Support</th>
+            <th class="text-left" style="width: 50%">Typical Use Case</th>
+        </tr>
+    </thead>
+    <tbody>
+        <tr>
+            <td>Local Run with Test Data</td>
+            <td>Only Python</td>
+            <td>Validate the internal logic of the Agent.</td>
+        </tr>
+       <tr>
+            <td>Local Run with Flink MiniCluster</td>
+            <td>Python &amp; Java</td>
+            <td>Verify upstream/downstream connectivity and schema 
correctness.</td>
+        </tr>
+       <tr>
+            <td>Run in Flink Cluster</td>
+            <td>Python &amp; Java</td>
+            <td>Large-scale data and AI processing in production 
environments.</td>
+        </tr>
+    </tbody>
+</table>
+
+
+
 ## Local Run with Test Data
 
-{{< hint warning >}}
-**TODO**: How to run with test data with LocalExecutorEnvironment.
-{{< /hint >}}
+After completing the [installation of flink-agents]({{< ref 
"docs/get-started/installation" >}}) and [building your agent]({{< ref 
"docs/development/workflow_agent" >}}), you can test and execute your agent 
locally using a simple Python script. This allows you to validate logic without 
requiring a Flink cluster.
+
+### Key Features
+
+- **No Flink Required**: Local execution is ideal for development and testing.
+- **Test Data Simulation**: Easily inject mock inputs for validation.
+- **IDE Compatibility**: Run directly in your preferred development 
environment.
+
+### Example for Local Run with Test Data
+
+#### Complete code
+
+``````python
+from flink_agents.api.execution_environment import AgentsExecutionEnvironment
+from my_module.agents import MyAgent  # Replace with your actual agent path
+
+if __name__ == "__main__":
+    # 1. Initialize environment
+    env = AgentsExecutionEnvironment.get_execution_environment()
+    
+    # 2. Prepare test data
+    input_data = [
+        {"key": "0001", "value": "Calculate the sum of 1 and 2."},
+        {"key": "0002", "value": "Tell me a joke about cats."}
+    ]
+    
+    # 3. Create agent instance
+    agent = MyAgent()
+    
+    # 4. Build pipeline
+    output_data = env.from_list(input_data) \
+                     .apply(agent) \
+                     .to_list()
+    
+    # 5. Execute and show results
+    env.execute()
+    
+    print("\nExecution Results:")
+    for record in output_data:
+        for key, value in record.items():
+            print(f"{key}: {value}")
+
+``````
+
+#### Input Data Format
+
+The input data should be a list of dictionaries (`List[Dict[str, Any]]`) with 
the following structure:
+
+``````python
+[
+    {
+       # Optional field: Input key
+        "key": "key_1",
+        
+        # Required field: Input content
+        # This becomes the `input` field in InputEvent
+        "value": "Calculate the sum of 1 and 2.",
+    },
+    ...
+]
+``````
+
+#### Output Data Format
+
+The output data is a list of dictionaries (`List[Dict[str, Any]]`) where each 
dictionary contains a single key-value pair representing the processed result. 
The structure is generated from `OutputEvent` objects:
+
+``````python
+[
+    {key_1: output_1},  # From first OutputEvent
+    {key_2: output_2},  # From second OutputEvent
+    ...
+]
+``````
+
+
 
 ## Local Run with Flink MiniCluster
 
-{{< hint warning >}}
-**TODO**: How to run with Flink MiniCluster locally.
-{{< /hint >}}
+After completing the [installation of flink-agents]({{< ref 
"docs/get-started/installation" >}}) and [building your agent]({{< ref 
"docs/development/workflow_agent" >}}), you can test and execute your agent 
locally using a **Flink MiniCluster**. This allows you to have a lightweight 
Flink streaming environment without deploying to a full cluster. For more 
details about how to integrate agents with Flink's `DataStream` or `Table`, 
please refer to the [Integrate with Flink]({{< ref 
"docs/development/integrate_with_flink" >}}) documentation.
+
+
 
 ## Run in Flink Cluster
 
-{{< hint warning >}}
-**TODO**: How to run in Flink Cluster.
-{{< /hint >}}
\ No newline at end of file
+Flink Agents jobs are deployed and run on the cluster similarly to Pyflink 
jobs. You can refer to the instructions for [submitting PyFlink 
jobs](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/deployment/cli/#submitting-pyflink-jobs)
 for more details.
+
+
+
+### Prerequisites
+
+- **Operating System**: Unix-like environment (Linux, macOS, Cygwin, or WSL)  
+- **Python**: Version 3.10 or 3.11  
+- **Flink**: A running Flink cluster with the Flink Agents dependency 
installed  
+
+
+
+### Prepare Flink Agents
+
+We recommand creating a Python virtual environment to install the Flink Agents 
Python library.
+
+Follow the [instructions]({{< ref "docs/get-started/installation" >}}) to 
install the Flink Agents Python and Java libraries.
+
+
+
+### Prepare Flink

Review Comment:
   This is to maintain consistency with the command `./flink-1.20.3/bin/flink` 
below.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to