Skip to content

feat: add session id to task tool metadata#3559

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
brandonwisnicki:bwiz/surface-task-session
Oct 30, 2025
Merged

feat: add session id to task tool metadata#3559
rekram1-node merged 1 commit into
anomalyco:devfrom
brandonwisnicki:bwiz/surface-task-session

Conversation

@brandonwisnicki

@brandonwisnicki brandonwisnicki commented Oct 30, 2025

Copy link
Copy Markdown
Contributor

When an agent invokes a Task/subagent, it has no good way of knowing the session that the subagent created (as far as I'm aware). While you are able to get it from the summary, this array is only populated when tools are called, so there could be a delay or not appear at all if the subagent does not invoke a tool.

This PR surfaces the subagent's session ID to the invoking agent right after the session is created. This allows the invoking agent to have a UI around the specific subagent's session in a more first class way.

Thank you!

@brandonwisnicki
brandonwisnicki marked this pull request as ready for review October 30, 2025 07:03
@brandonwisnicki
brandonwisnicki force-pushed the bwiz/surface-task-session branch from 275427b to 820c797 Compare October 30, 2025 07:05
@brandonwisnicki
brandonwisnicki force-pushed the bwiz/surface-task-session branch from 820c797 to a28097c Compare October 30, 2025 07:05
@brandonwisnicki brandonwisnicki changed the title Adds session id to Agent context metadata feat: Adds session id to Agent context metadata Oct 30, 2025
@rekram1-node

Copy link
Copy Markdown
Collaborator

agent to have a UI around the specific subagent's session in a more first class way.

Can you explain what you mean by this? I may just be blanking but of what use is it to primary agent to give it a session id?

Also I don't think the metadata of a tool is ever presented to the llm anyway but I could be wrong

@brandonwisnicki

Copy link
Copy Markdown
Contributor Author

agent to have a UI around the specific subagent's session in a more first class way.

Can you explain what you mean by this? I may just be blanking but of what use is it to primary agent to give it a session id?

Also I don't think the metadata of a tool is ever presented to the llm anyway but I could be wrong

This is helpful for retrieving it with the SDK, not so much for use by the LLM. For more context, my use case is building a UI that supports threads in a chat. So when a subagent is spun up, it creates a thread that users can open up. When rendering the Task tool in the primary agent's chat, I want to have a button that opens up the thread from there. In order to do this, I need the session ID that the specific thread spun up.

@rekram1-node

Copy link
Copy Markdown
Collaborator

Oh okay cool, just wanted to see what the reasoning was. In that case it makes sense

@rekram1-node rekram1-node changed the title feat: Adds session id to Agent context metadata feat: add session id to task tool metadata Oct 30, 2025
@rekram1-node
rekram1-node merged commit c68607f into anomalyco:dev Oct 30, 2025
3 checks passed
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Co-authored-by: Brandon Wisnicki <bwisnicki@palantir.com>
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request May 5, 2026
Co-authored-by: Brandon Wisnicki <bwisnicki@palantir.com>
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Co-authored-by: Brandon Wisnicki <bwisnicki@palantir.com>
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Co-authored-by: Brandon Wisnicki <bwisnicki@palantir.com>
avion23 pushed a commit to avion23/opencode that referenced this pull request Jun 10, 2026
Co-authored-by: Brandon Wisnicki <bwisnicki@palantir.com>
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request Jun 14, 2026
Co-authored-by: Brandon Wisnicki <bwisnicki@palantir.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants