Back to feed
Dev.to
Dev.to
7/11/2026
My Agent Kept Writing sleep Loops. So I Gave It a Better Primitive

My Agent Kept Writing sleep Loops. So I Gave It a Better Primitive

Short summary

The author identified that AI agents repeatedly write fragile sleep-and-curl loops to wait for deployments, often exiting on stale responses. They built opencode-waitfor, a zero-dependency plugin providing a single wait_for tool that handles HTTP polling, TCP checks, and shell commands with expected-response matching. On timeout it returns the last observed state so agents can diagnose failures without re-probing.

  • Agents write fragile sleep loops because they lack a readiness primitive
  • opencode-waitfor plugin adds a wait_for tool for HTTP, TCP, and shell readiness checks
  • Returns last observed state on timeout for agent self-diagnosis

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more