Skip to content

Doc built in actions - #669

Merged
xintongsong merged 5 commits into
apache:mainfrom
da-daken:doc_built-in_actions
May 28, 2026
Merged

xintongsong merged 5 commits into
apache:mainfrom
da-daken:doc_built-in_actions

Conversation

@da-daken

@da-daken da-daken commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Linked issue: #653

Purpose of change

Add explanations for built-in actions

Tests

dot need test

API

no api

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions Bot added doc-needed Your PR changes impact docs. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue. and removed doc-needed Your PR changes impact docs. labels May 13, 2026
@da-daken

Copy link
Copy Markdown
Contributor Author

hi @wenjin272 ,I'm not sure if this description meets your expectations. PTAL

@github-actions github-actions Bot added doc-included Your PR already contains the necessary documentation updates. and removed doc-needed Your PR changes impact docs. labels May 14, 2026

@weiqingy weiqingy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the doc — the descriptions track the code behavior accurately. A few small wording nits inline; nothing structural.


## 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`.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small subject-verb fix: "the action send a ChatResponseEvent" → "the action sends". Same issue two lines down on 1223 ("chat_model_action send a ToolRequestEvent"), so worth catching both in one sweep.


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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The trailing "For details on how tools are executed." reads as a fragment because the cross-link sits on the next line. Could you fold it into a single sentence — something like "For details on how tools are executed, see Built-in Events and Actions in Tool Use" — so the section closes on a complete clause?


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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two readability nits on this line: there's a missing space between "tool responses." and "Users can also send…", and the topic shift from "chat_model_action handles tool responses" to "you can also send ToolRequestEvent directly" reads better as a separate sentence on its own paragraph. Splitting them gives the "you can also invoke tools manually" hook a clearer landing spot.

@da-daken

Copy link
Copy Markdown
Contributor Author

Thanks for the doc — the descriptions track the code behavior accurately. A few small wording nits inline; nothing structural.

@weiqingy Thanks for your review. I fixed the grammar mistakes above and put the citation on one line. PTAL

@weiqingy weiqingy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick turnaround — the wording reads cleanly now. LGTM.

@xintongsong xintongsong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @da-daken for working on this, and thanks @weiqingy for the careful review. LGTM. Merging.

@xintongsong
xintongsong merged commit 918f812 into apache:main May 28, 2026
49 of 50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-included Your PR already contains the necessary documentation updates. fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants