binary-husky/gpt_academic · warning · TimeoutError

等待用户输入超时

Error message

等待用户输入超时

What it means

AutoGen's get_human_input hook sends an interact prompt through the multiprocess pipe and polls for a reply every 0.5 seconds. If no reply arrives within 300 seconds, it sends a done message and raises TimeoutError to end the agent run.

Source

Thrown at crazy_functions/agent_fns/general.py:61

    def gpt_academic_get_human_input(self, user_proxy, message):
        # ⭐⭐ run in subprocess
        patience = 300
        begin_waiting_time = time.time()
        self.child_conn.send(PipeCom("interact", message))
        while True:
            time.sleep(0.5)
            if self.child_conn.poll():
                wait_success = True
                break
            if time.time() - begin_waiting_time > patience:
                self.child_conn.send(PipeCom("done", ""))
                wait_success = False
                break
        if wait_success:
            return self.child_conn.recv().content
        else:
            raise TimeoutError("等待用户输入超时")

    def define_agents(self):
        raise NotImplementedError

    def exe_autogen(self, input):
        # ⭐⭐ run in subprocess
        input = input.content
        code_execution_config = {"work_dir": self.autogen_work_dir, "use_docker": self.use_docker}
        agents = self.define_agents()
        user_proxy = None
        assistant = None
        for agent_kwargs in agents:
            agent_cls = agent_kwargs.pop('cls')
            kwargs = {
                'llm_config':self.llm_kwargs,
                'code_execution_config':code_execution_config
            }
            kwargs.update(agent_kwargs)

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Watch for the interact prompt and reply before the 300-second deadline.
  2. Configure agents to avoid human input for autonomous runs.
  3. Increase patience if interactive sessions legitimately need more time.
  4. Catch TimeoutError and report that user input was not received instead of leaving a generic AutoGen failure.
  5. Keep the parent UI/process alive while the agent is waiting.

Example fix

# before
patience = 300

# after
patience = int(os.environ.get("AUTOGEN_HUMAN_INPUT_TIMEOUT", "300"))
Defensive patterns

Strategy: try-catch

Validate before calling

if not interactive_session_active:
    configure_agents_without_human_input()

Try / catch

try:
    user_input = self.gpt_academic_get_human_input(user_proxy, message)
except TimeoutError:
    send_agent_status("Timed out waiting for user input")
    raise

Prevention

When it happens

Trigger: An AutoGen agent calls get_human_input and the user does not answer in the web UI, the UI session is closed or disconnected, or the pipe message is consumed elsewhere so child_conn.poll() never sees it.

Common situations: Unattended or background agent runs; a chat agent configured to ask clarifying questions; the user switches tabs or loses the session; a subprocess/UI protocol mismatch; long-running work after the prompt exceeds five minutes.

Related errors


AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14). Data as JSON: /api/errors/1053ce33a2a525bc. Report an issue: GitHub.