CrewAI Task Never Completes: Diagnosing the Silent Hang
TL;DR
A CrewAI task that never completes is almost always one agent stuck behind a wall in a tool it is using, a login, a rate limit, a page that did not load, while the rest of the crew waits on its output. Log every tool call with a timestamp and a hash of the result, find the agent whose results stopped changing, and give that tool a stop-and-ask path so a person can clear the wall instead of the crew timing out.
Nothing is hung. One agent is stuck, and everything downstream is politely waiting for it. Find the one whose tool results stopped changing and you have found your problem.
Find the stuck agent
CrewAI's default output tells you which task is running but not what the agent inside it is doing. Add a step callback that records the tool name, a timestamp and a hash of the result. The stuck agent is the one producing the same hash repeatedly, or the one whose last call never returned.
import hashlib, time
def step(output):
digest = hashlib.sha256(str(output).encode()).hexdigest()[:10]
print(f"{time.strftime('%H:%M:%S')} {output.tool} -> {digest}")
crew = Crew(agents=[...], tasks=[...], step_callback=step)The usual culprits
- A browser tool on a login page, retrying into it and getting the same page back.
- A rate-limited API returning the same error the agent keeps re-reading as content.
- A page that never finished loading, so every scrape returns the loading skeleton.
Give the tool a way out
The fix is in the tool, not the crew. Any tool that touches the outside world should be able to say I am blocked and hand the situation to a person, rather than returning the same result forever. Two tools do it: one that asks whether a human has already solved this wall, and one that asks a human now. Give the browsing agent both, with descriptions that tell the model to check first and ask second.
With those in place a stuck crew stops being a twenty-minute mystery. The agent asks, a person clears the wall in the live browser, the tool returns real output, and the rest of the crew proceeds. The next crew that hits the same wall gets the answer from the first call.
Questions people ask
Why does my CrewAI crew hang without an error?
One agent is stuck behind a wall in a tool, often a login or a page that did not load, and the other agents are waiting on its output. There is no error because the tool keeps returning something.
How do I see what a CrewAI agent is doing?
Add a step_callback that logs the tool name, a timestamp and a hash of each result. The stuck agent is the one whose hashes stop changing.
How do I stop a CrewAI task from running forever?
Set max_iter on the agent, and give its outward-facing tools a stop-and-ask path so a blocked step goes to a person instead of repeating.
Can a human step in during a CrewAI run?
Yes, if a tool requests it. The tool opens a fix that a person completes in the live browser, then returns the real result so the crew continues.
DoubleOh is the reliability layer for AI agents. When one gets stuck, a person fixes it once in a live browser, and the fix becomes a skill the whole fleet follows from then on.
Start free