Conversation
Introduces a new span category 'parallel-agent-group' that enables the HUD platform to render parallel agent execution as a visual card with real-time progress tracking. New features: - ParallelAgentGroup class for managing parallel agent status - parallel_agent_group() async context manager for easy integration - Automatic span emission on status updates (running/completed/failed) - Exports from hud.telemetry and hud packages
|
not ready for review, just using this to test bugbot |
- Add trace_subagent parameter to AgentTool for separate traces - Include trace_id in tool result metadata for subagent calls - Update documentation with trace_subagent usage examples - Refactor test code to use modern Python with statement syntax
ryantzr1
left a comment
There was a problem hiding this comment.
HUD Bugbot Review
Found a critical indentation error in agent.py that will prevent the code from running.
| @@ -218,6 +231,15 @@ async def _run_subagent() -> ToolResult: | |||
|
|
|||
| result = await agent.run(ctx) | |||
| content = result.content if hasattr(result, "content") and result.content else "" | |||
There was a problem hiding this comment.
Incorrect indentation breaks return statement
High Severity
Line 233 has incorrect indentation. The line starting with content = result.content should be indented to align with the code block inside the async with statement, but appears to have only one space of indentation in the diff. This will cause a Python IndentationError and prevent the code from running.
Suggestion: Fix the indentation to properly align with the surrounding code block. The line should be indented to match the previous line (agent = self._agent_cls.create(**self._agent_params)) and the following return statement.
ryantzr1
left a comment
There was a problem hiding this comment.
HUD Bugbot Review
Found critical indentation error in agent.py that will break execution flow, plus a logic issue with trace_id generation.
| return ToolResult(content=[TextContent(type="text", text=content)]) | ||
|
|
||
| return await _run_subagent() | ||
| return ToolResult( |
There was a problem hiding this comment.
Incorrect indentation causes syntax/logic error
High Severity
The return ToolResult(...) statement starting at line 234 is incorrectly indented. It appears to be inside the else block (line 233) when it should be at the same indentation level as the if self._model: block (line 228). This will cause the return statement to only execute when self._model is falsy, which breaks the normal execution flow when self._model is truthy.
Suggestion: Dedent lines 234-237 to align with line 228:
result = await agent.run(ctx)
content = result.content if hasattr(result, "content") and result.content else ""
return ToolResult(
content=[TextContent(type="text", text=content)],
meta={"trace_id": trace_id} if trace_id else None,
)|
|
||
| # Wrap execution with instrumentation to mark as subagent | ||
| # Platform uses category="subagent" to detect and render subagent tool calls | ||
| @instrument(category="subagent", name=self.name) |
There was a problem hiding this comment.
Redundant condition when creating trace_id
Medium Severity
The condition elif self._trace or self._trace_subagent: on line 215 is redundant because should_trace (calculated on line 205) already evaluates the same conditions. When use_parent_trace is False and we reach line 215, we should generate a new trace_id only if should_trace is True. The current logic could generate a trace_id even when should_trace=False in certain edge cases (e.g., when both _trace and _trace_subagent are False but we're not using parent trace).
Suggestion: Replace the condition with:
elif should_trace:
trace_id = str(uuid.uuid4())
Introduces a new span category 'parallel-agent-group' that enables the HUD platform to render parallel agent execution as a visual card with real-time progress tracking.
New features:
Note
Enables UI-visible tracking of multiple agents running in parallel with progress updates and final status.
ParallelAgentGroup,ParallelAgentInfo, andasyncparallel_agent_group(...)to manage agent statuses and emitcategory: parallel-agent-groupspans viaqueue_spantrace_id,TraceStepattributes, per-agent status, and setstatus_codetoERRORon failures; initial updates and final summary are automatically emittedhud.telemetryand top-levelhud(__all__updates)Written by Cursor Bugbot for commit 621c026. This will update automatically on new commits. Configure here.