Just a heads-up and to pick your brain a bit: - Re...
# proj-architecture
c
Just a heads-up and to pick your brain a bit: • Re: Slack conversation last agent message • Re: the PR on it • Re: other clients (e.g. GH) https://github.com/OpenHands/OpenHands/issues/13714
c
I vaguely remember we had some code in the SDK that would allow us to get the "last agent finish message" (including "message" event). @nutritious-balloon-65098 can you look that up in OpenHands/software-agent-sdk and tell me if that's true?
❤️ 1
n
I'm on it! Xingyao Wang can track my progress here.
## Summary You asked whether the SDK has code to get the "last agent finish message" (including a "message" event). The answer is yes. The function is
get_agent_final_response()
, located at
openhands-sdk/openhands/sdk/conversation/response_utils.py
and publicly exported from
openhands.sdk.conversation
. It iterates events in reverse and returns the text from the first match of either: 1. A
FinishAction
— an
ActionEvent
from the agent with
tool_name="finish"
, returning
event.action.message
. 2. A
MessageEvent
— a plain text response from the agent (no tool calls), returning the joined text content. It's used by the delegate tool, the task manager, and several integration tests. No code changes were made.
c
@nutritious-balloon-65098 can you post some details to the https://github.com/OpenHands/OpenHands/issues/13714 including how we could make that available as an agent-server API?
n
I'm on it! Xingyao Wang can continue tracking my progress here.
## Summary Here's what was done: 1. Looked up the SDK code: Confirmed that
get_agent_final_response()
exists at
openhands-sdk/openhands/sdk/conversation/response_utils.py
, publicly exported from
openhands.sdk.conversation
. It handles both
FinishAction
(finish tool call) and
MessageEvent
(plain text response with no tool calls) by walking events in reverse. 2. Posted a detailed comment to [OpenHands/OpenHands#13714](https://github.com/OpenHands/OpenHands/issues/13714#issuecomment-4181853292) covering: - What the existing SDK function does and where it lives - Where it's already used internally (delegate tool, task manager, integration tests) - Two concrete options for exposing it as an agent-server REST API (dedicated endpoint vs. field on
ConversationInfo
), with a recommendation for Option A - How this relates to PR #13043 (Slack) — noting that the Slack PR currently only handles
MessageEvent
client-side and misses the
FinishAction
case, which a server-side endpoint would fix for all clients No code changes were made — this was purely an investigation + posting findings to the GitHub issue. No commits or branches needed.
c
Thank you! I didn't realize that. We could run with it. 🤔 I was thinking that maybe we want events... for example to include reasoning too. The client formats the event, extracting reasoning or ignoring it, sending some markdown or not. Or just append it...
c
replied in the github PR - maybe just do the text based endpoint would be sufficient for such simple endpoint?
👍 1
c
Right, sorry. The funny part is, my agent made large changes to this API in its typescript version of agent-sdk: it even introduced a notion of "/turn" in the REST API ugh awkward monkey look Against my best judgment. But I've been overrun by the little feline team, so I'm still dizzy - I haz scars 😅 OK. Text it is. Simple. KISS. 🤣