bytedance / bytedance/trae-agent

为啥每次循环,都把messages重置,这样不会丢失上下文吗

Open
#151 2 comments 1 reaction 0 assignees View on GitHub
status/need-triage type/question
Dominant language
Python
Stars
12.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

### What is your question?

if self.llm_indicates_task_completed(llm_response):
if self._is_task_completed(llm_response):
self._llm_complete_response_task_handler(
llm_response, step, execution, messages
)
break
else:
step.state = AgentState.THINKING
messages = [
LLMMessage(role="user", content=self.task_incomplete_message())
]
else:
# Check if the response contains a tool call
tool_calls = llm_response.tool_calls
messages = await self._tool_call_handler(tool_calls, step)

### Additional information that you believe is relevant to this question

_No response_

Contributor guide

Open the contributing guide

Research direction

The issue points to the loop branches containing llm_indicates_task_completed, _is_task_completed, and _tool_call_handler; start by tracing how messages is initialized and replaced across iterations. Compare the completion and tool-call paths, then review the comment thread for the intended context behavior. The issue does not define the expected final behavior, so that must be clarified before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
ai, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.