Skip to content

feat: update gui custom agent fields#108

Merged
sebzhao merged 18 commits into
mainfrom
seb/gui-custom-agent
May 27, 2026
Merged

feat: update gui custom agent fields#108
sebzhao merged 18 commits into
mainfrom
seb/gui-custom-agent

Conversation

@sebzhao
Copy link
Copy Markdown
Contributor

@sebzhao sebzhao commented May 7, 2026

Children field for custom agent runs to allow for nested GUI traces.

@sebzhao sebzhao requested a review from xTRam1 May 7, 2026 19:51
@sebzhao sebzhao requested a review from dragon18456 May 19, 2026 23:52
Comment thread packages/narada-core/src/narada_core/tracing/model.py
Comment thread packages/narada-pyodide/src/narada/window.py Outdated
@sebzhao
Copy link
Copy Markdown
Contributor Author

sebzhao commented May 22, 2026

@review

Comment thread packages/narada-core/src/narada_core/actions/models.py
Comment thread packages/narada-core/src/narada_core/tracing/model.py
Comment thread packages/narada-pyodide/src/narada/window.py
Copy link
Copy Markdown
Contributor

@xTRam1 xTRam1 left a comment

Choose a reason for hiding this comment

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

I rechecked the SDK PR head. It has not changed since the last round, so the public response-contract gap is still present.

Comment thread packages/narada-core/src/narada_core/actions/models.py
Comment thread packages/narada-core/src/narada_core/tracing/model.py
Comment thread packages/narada-pyodide/src/narada/window.py
Copy link
Copy Markdown
Contributor

@xTRam1 xTRam1 left a comment

Choose a reason for hiding this comment

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

The AgentResponse.workflow_trace contract gap is fixed now. I found one follow-up issue in the new propagation behavior before I can stamp the SDK PR: the trace event emission needs to be made mutually exclusive with backend parent/child stitching so nested calls do not show the same child twice.

else None
)
workflow_trace = response_content.get("workflowTrace")
if workflow_trace is not None:
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.

[P1] This now preserves workflowTrace on AgentResponse, which fixes the public SDK contract. The remaining problem is that this also emits a subWorkflow trace event unconditionally. For nested window.agent() calls, dispatch_request() already emits a subAgentCall event with the child request_id, and the backend stitcher uses that request id to replace the SDK event with the child remote-dispatch row's workflowTrace. If we also emit subWorkflow here, the parent Python trace can contain both the original subAgentCall and this subWorkflow; the backend currently replaces only the first matching node, so the other one can remain and render the same child twice.

Please make this mutually exclusive with the parent-request stitching path, or remove the trace emission here and only expose the field on AgentResponse. For example:

workflow_trace = response_content.get("workflowTrace")
parent_request_id = self._current_parent_request_id()

# Preserve the response contract for direct callers, but avoid adding a second
# child node when the backend will stitch the child request into the parent row.
if workflow_trace is not None and parent_request_id is None:
    _trace.emit_sub_workflow(workflow_trace=workflow_trace)

return AgentResponse(
    ...,
    action_trace=action_trace,
    workflow_trace=workflow_trace,
)

I would also add a regression test for the nested case: set an injected parent request id, return a response with workflowTrace, and assert we do not emit an extra subWorkflow event on top of the existing subAgentCall/SQL-stitching path. The direct no-parent case Sebastian tested should still keep AgentResponse.workflow_trace populated.

Copy link
Copy Markdown
Contributor

@xTRam1 xTRam1 left a comment

Choose a reason for hiding this comment

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

Approving. The original SDK response-contract blocker is fixed: AgentResponse now exposes workflow_trace, and both pyodide and non-pyodide window.agent() populate it. The remaining comment about avoiding duplicate subWorkflow emission in nested runs is a small contained follow-up, but please address it before merging so the observability view does not risk rendering the same child workflow twice.

Copy link
Copy Markdown
Contributor

@xTRam1 xTRam1 left a comment

Choose a reason for hiding this comment

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

Approving the latest head as well. The response-contract blocker is fixed, and the follow-up deduplication issue is now handled by only emitting the SDK subWorkflow event for direct/no-parent calls while preserving AgentResponse.workflow_trace for all callers.

@sebzhao sebzhao merged commit 25f20a7 into main May 27, 2026
5 checks passed
@sebzhao sebzhao deleted the seb/gui-custom-agent branch May 27, 2026 21:40
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