From 1794f4aeec0a231becb1d8618b92bf37f3391ece Mon Sep 17 00:00:00 2001 From: daken Date: Tue, 12 May 2026 23:49:03 +0800 Subject: [PATCH 1/2] [doc] Add explanations for built-in actions --- docs/content/docs/development/chat_models.md | 5 +++++ docs/content/docs/development/tool_use.md | 6 ++++++ docs/content/docs/development/vector_stores.md | 6 +++++- docs/content/docs/development/workflow_agent.md | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/content/docs/development/chat_models.md b/docs/content/docs/development/chat_models.md index 99ac9d7e5..1b77cdf49 100644 --- a/docs/content/docs/development/chat_models.md +++ b/docs/content/docs/development/chat_models.md @@ -1216,3 +1216,8 @@ public class MyChatModelSetup extends BaseChatModelSetup { {{< /tabs >}} +## Built-in Events and Actions + +The built-in `chat_model_action` listens to `ChatRequestEvent` and `ToolResponseEvent`. To request a chat completion, send a `ChatRequestEvent`. If the model returns a final answer, the action emits a `ChatResponseEvent`. + +If the model asks to call tools, `chat_model_action` emits a `ToolRequestEvent` instead of a final `ChatResponseEvent`. After the tools finish, it receives the matching `ToolResponseEvent`, appends the tool results to the chat history, and calls the model again. This loop continues until the model returns a final response. \ No newline at end of file diff --git a/docs/content/docs/development/tool_use.md b/docs/content/docs/development/tool_use.md index e7ab7a23d..520320060 100644 --- a/docs/content/docs/development/tool_use.md +++ b/docs/content/docs/development/tool_use.md @@ -182,3 +182,9 @@ ReActAgent reviewAnalysisReactAgent = new ReActAgent( ## MCP Tool See [MCP]({{< ref "docs/development/mcp" >}}) for details. + +## Built-in Events and Actions + +The built-in `tool_call_action` listens to `ToolRequestEvent`. For each tool call, it looks up the tool resource by function name, executes it through durable execution, and records whether it succeeded. After all tool calls in the batch have been processed, it emits a `ToolResponseEvent`. + +When the tool request comes from `chat_model_action`, the emitted `ToolResponseEvent` is automatically consumed by `chat_model_action` to continue the chat. Users can also send `ToolRequestEvent` directly when they want to invoke tools programmatically. \ No newline at end of file diff --git a/docs/content/docs/development/vector_stores.md b/docs/content/docs/development/vector_stores.md index decc9c0d0..155446b3a 100644 --- a/docs/content/docs/development/vector_stores.md +++ b/docs/content/docs/development/vector_stores.md @@ -1101,4 +1101,8 @@ public class MyVectorStore extends BaseVectorStore {{< /tab >}} -{{< /tabs >}} \ No newline at end of file +{{< /tabs >}} + +## Built-in Events and Actions + +The built-in `context_retrieval_action` listens to `ContextRetrievalRequestEvent`. To retrieve relevant documents, send a `ContextRetrievalRequestEvent`. The action queries the configured vector store through durable execution and emits a `ContextRetrievalResponseEvent`. \ No newline at end of file diff --git a/docs/content/docs/development/workflow_agent.md b/docs/content/docs/development/workflow_agent.md index f122727fa..9c66aed5f 100644 --- a/docs/content/docs/development/workflow_agent.md +++ b/docs/content/docs/development/workflow_agent.md @@ -611,3 +611,4 @@ All attribute values must be JSON-serializable. In Python, this means `BaseModel There are several built-in `Event` and `Action` in Flink-Agents: * See [Chat Models]({{< ref "docs/development/chat_models" >}}) for how to chat with a LLM leveraging built-in action and events. * See [Tool Use]({{< ref "docs/development/tool_use" >}}) for how to programmatically use a tool leveraging built-in action and events. +* See [Vector Stores]({{< ref "docs/development/vector_stores" >}}) for how to retrieve context from vector stores leveraging built-in action and events. \ No newline at end of file From cbc00f578dd75599171206cc1680d56a9b7554ff Mon Sep 17 00:00:00 2001 From: daken Date: Thu, 14 May 2026 00:54:26 +0800 Subject: [PATCH 2/2] [doc] add reference in tool_use.md,chat_models.md --- docs/content/docs/development/chat_models.md | 5 +++-- docs/content/docs/development/tool_use.md | 4 ++-- docs/content/docs/development/vector_stores.md | 2 +- docs/content/docs/development/workflow_agent.md | 6 +++--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/content/docs/development/chat_models.md b/docs/content/docs/development/chat_models.md index 1b77cdf49..d5f3ee05c 100644 --- a/docs/content/docs/development/chat_models.md +++ b/docs/content/docs/development/chat_models.md @@ -1218,6 +1218,7 @@ public class MyChatModelSetup extends BaseChatModelSetup { ## Built-in Events and Actions -The built-in `chat_model_action` listens to `ChatRequestEvent` and `ToolResponseEvent`. To request a chat completion, send a `ChatRequestEvent`. If the model returns a final answer, the action emits a `ChatResponseEvent`. +The built-in `chat_model_action` listens to `ChatRequestEvent` and `ToolResponseEvent`. To request a chat completion, send a `ChatRequestEvent`. If the model returns a final answer, the action send a `ChatResponseEvent`. -If the model asks to call tools, `chat_model_action` emits a `ToolRequestEvent` instead of a final `ChatResponseEvent`. After the tools finish, it receives the matching `ToolResponseEvent`, appends the tool results to the chat history, and calls the model again. This loop continues until the model returns a final response. \ No newline at end of file +If the model asks to call tools, `chat_model_action` send a `ToolRequestEvent` instead of a final `ChatResponseEvent`. After the tools finish, it receives the matching `ToolResponseEvent`, appends the tool results to the chat history, and calls the model again. This loop continues until the model returns a final response. For details on how tools are executed. +See [Built-in Events and Actions in Tool Use]({{< ref "docs/development/tool_use#built-in-events-and-actions" >}}). \ No newline at end of file diff --git a/docs/content/docs/development/tool_use.md b/docs/content/docs/development/tool_use.md index 520320060..ca940c4ae 100644 --- a/docs/content/docs/development/tool_use.md +++ b/docs/content/docs/development/tool_use.md @@ -185,6 +185,6 @@ See [MCP]({{< ref "docs/development/mcp" >}}) for details. ## Built-in Events and Actions -The built-in `tool_call_action` listens to `ToolRequestEvent`. For each tool call, it looks up the tool resource by function name, executes it through durable execution, and records whether it succeeded. After all tool calls in the batch have been processed, it emits a `ToolResponseEvent`. +The built-in `tool_call_action` listens to `ToolRequestEvent`. For each tool call, it looks up the tool resource by function name, executes it through durable execution, and records whether it succeeded. After all tool calls in the batch have been processed, it sends a `ToolResponseEvent`. -When the tool request comes from `chat_model_action`, the emitted `ToolResponseEvent` is automatically consumed by `chat_model_action` to continue the chat. Users can also send `ToolRequestEvent` directly when they want to invoke tools programmatically. \ No newline at end of file +When the tool request comes from `chat_model_action`, the emitted `ToolResponseEvent` is automatically consumed by `chat_model_action` to continue the chat. See [Built-in Events and Actions in Chat Models]({{< ref "docs/development/chat_models#built-in-events-and-actions" >}}) for details on how `chat_model_action` handles tool responses.Users can also send `ToolRequestEvent` directly when they want to invoke tools programmatically. \ No newline at end of file diff --git a/docs/content/docs/development/vector_stores.md b/docs/content/docs/development/vector_stores.md index 155446b3a..808350799 100644 --- a/docs/content/docs/development/vector_stores.md +++ b/docs/content/docs/development/vector_stores.md @@ -1105,4 +1105,4 @@ public class MyVectorStore extends BaseVectorStore ## Built-in Events and Actions -The built-in `context_retrieval_action` listens to `ContextRetrievalRequestEvent`. To retrieve relevant documents, send a `ContextRetrievalRequestEvent`. The action queries the configured vector store through durable execution and emits a `ContextRetrievalResponseEvent`. \ No newline at end of file +The built-in `context_retrieval_action` listens to `ContextRetrievalRequestEvent`. To retrieve relevant documents, send a `ContextRetrievalRequestEvent`. The action queries the configured vector store through durable execution and sends a `ContextRetrievalResponseEvent`. \ No newline at end of file diff --git a/docs/content/docs/development/workflow_agent.md b/docs/content/docs/development/workflow_agent.md index 9c66aed5f..11ef50502 100644 --- a/docs/content/docs/development/workflow_agent.md +++ b/docs/content/docs/development/workflow_agent.md @@ -609,6 +609,6 @@ All attribute values must be JSON-serializable. In Python, this means `BaseModel ## Built-in Events and Actions There are several built-in `Event` and `Action` in Flink-Agents: -* See [Chat Models]({{< ref "docs/development/chat_models" >}}) for how to chat with a LLM leveraging built-in action and events. -* See [Tool Use]({{< ref "docs/development/tool_use" >}}) for how to programmatically use a tool leveraging built-in action and events. -* See [Vector Stores]({{< ref "docs/development/vector_stores" >}}) for how to retrieve context from vector stores leveraging built-in action and events. \ No newline at end of file +* See [Chat Models]({{< ref "docs/development/chat_models#built-in-events-and-actions" >}}) for how to chat with a LLM leveraging built-in action and events. +* See [Tool Use]({{< ref "docs/development/tool_use#built-in-events-and-actions" >}}) for how to programmatically use a tool leveraging built-in action and events. +* See [Vector Stores]({{< ref "docs/development/vector_stores#built-in-events-and-actions" >}}) for how to retrieve context from vector stores leveraging built-in action and events. \ No newline at end of file