Skip to content

ThoughEvent triggers termination via TextMentionTermination #6384

@yidasanqian

Description

@yidasanqian

What happened?

Describe the bug
The content with the 'think' tag from Deepseek r1 was sent to the group chat, causing abnormal exit

To Reproduce
Steps to reproduce the behavior. Please include code and outputs such as stacktrace.

code_executor_agent = CodeExecutorAgent(
            name="code_executor", code_executor=code_executor
        )

        assistant_agent = AssistantAgent(
            name="coder_agent",
            model_client=self.model_client,
            system_message=DEFAULT_SYSTEM_MESSAGE,
            model_client_stream=True,
        )

        # The termination condition is a combination of text termination and max message termination, either of which will cause the chat to terminate.
        termination = TextMentionTermination("TERMINATE") | MaxMessageTermination(20)

        # The group chat will alternate between the assistant and the code executor.
        self.group_chat = RoundRobinGroupChat(
            [assistant_agent, code_executor_agent], termination_condition=termination
        )

Expected behavior
Content from the "think" tag should not be sent to group chats.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
terminate prompt:

Only reply with "TERMINATE" at the end of the answer when the specific results from `code_executor` are obtained and all tasks are confirmed to be resolved.

Which packages was the bug in?

Python AgentChat (autogen-agentchat>=0.4.0)

AutoGen library version.

autogen-agentchat==0.5.3
autogen-ext==0.5.3

Other library version.

No response

Model used

deepseek r1

Model provider

OpenRouter/deepseek/siliconflow

Other model provider

No response

Python version

3.12

.NET version

None

Operating system

Windows

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions