Skip to content

[Feature Request] SingleAgentWorker lacks unified streaming handling, task-scoped execution context, and structured attempt tracking #3972

@fengju0213

Description

@fengju0213

Required prerequisites

Motivation

Problem

SingleAgentWorker._process_task has three issues:

  • Two separate streaming consumption paths — structured-handler and native-structured-output each inline their own async for chunk in response loop. They differ in content accumulation (delta vs cumulative not handled), TaskResult extraction, and stream_callback forwarding. Bug fixes must be applied twice.
  • No task-scoped execution context — worker agents have no way to know which task/attempt they're executing. Downstream (eigent) needs task_id, attempt number, and agent IDs on every lifecycle event for debugging and telemetry, but must patch this externally.
  • Flat, minimal attempt recordsworker_attempts entries contain only response_content[:50], tool_calls[:50], and total_tokens. Full token usage (prompt_tokens, etc.), tool call count, and execution context are lost.
  • Agent pool context leakage — when an agent is returned to the pool, _execution_context from the previous task is not cleared, potentially leaking to the next borrower.

Solution

No response

Alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions