diff --git a/docs/content/docs/development/chat_models.md b/docs/content/docs/development/chat_models.md index 99ac9d7e5..d5f3ee05c 100644 --- a/docs/content/docs/development/chat_models.md +++ b/docs/content/docs/development/chat_models.md @@ -1216,3 +1216,9 @@ 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 send a `ChatResponseEvent`. + +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 e7ab7a23d..ca940c4ae 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 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. 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 decc9c0d0..808350799 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 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 f122727fa..11ef50502 100644 --- a/docs/content/docs/development/workflow_agent.md +++ b/docs/content/docs/development/workflow_agent.md @@ -609,5 +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 [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