Prompts for building or driving AI agents.
13votes
0answers
1.6kviews

Stop conditions and loop budget for a ReAct agent so it terminates instead of spinning

Classic ReAct thought/action/observation loop. Two failure modes: it either declares victory too early (before the task is actually verified) or it never stops, re-checking the same thing while convin
25votes
1answers
3.6kviews

Prompt for an agent that reviews PRs and actually finds real bugs, not style nits

I run this as the system prompt for a code-review agent hooked to our CI. Before this, 90% of its comments were style nitpicks nobody wanted. The reframing that fixed it: make the agent predict runtim
10votes
0answers
2.3kviews

System prompt for a customer support agent that knows when to escalate

We shipped a support agent and the biggest problem wasn't wrong answers, it was confident wrong answers on questions it had no business answering. This system prompt made escalation behavior reliable.
57votes
2answers
5.3kviews

How do you stop a tool-use agent from calling the same function five times in a row?

I have a research agent with search, fetch, and a calculator tool. It gets into loops: searches, gets a mediocre result, searches again with a nearly identical query, and burns tokens/latency without
25votes
2answers
4.5kviews

Guardrail prompt so my coding agent stops inventing files it never read

Building an autonomous coding agent and the scariest bug wasn't a crash, it was confident fabrication: it would "edit" config/settings.py describing lines that didn't exist, because it never actually
23votes
2answers
4.2kviews

Support-agent system prompt with escalation rules that actually hand off cleanly

I build customer support bots and the recurring failure is the bot pretending it can do things it can't (issue refunds, change a subscription) and then dead-ending the user. Or the opposite: it escala
26votes
2answers
5.3kviews

System prompt for a docs chatbot that says "I don't know" instead of confidently making things up

We shipped a docs assistant and the failure mode wasn't rudeness or refusals, it was fluent, confident answers about features that don't exist. Worse than useless because people trusted it. The fix wa
13votes
2answers
3.1kviews

System prompt for a code-review agent that stops inventing style nitpicks

We run a review agent on every PR in CI. The first version was useless: it left 20 comments per PR, half of them were "consider renaming this variable" on code that hadn't changed, and it flagged form
27votes
1answers
3.5kviews

Self-verification step that catches an agent's own hallucinated file paths and APIs

My coding agent kept confidently importing functions that don't exist and referencing files it never opened. The plan looked great, the code didn't run. Classic. What moved the needle was a mandatory
14votes
1answers
2.8kviews

PR-review agent that outputs findings bucketed by severity with a fix-first ordering

Reviewers on my team were drowning in unordered agent output: a security bug buried under six style suggestions. Even good findings got missed because there was no triage. I restructured the review ag
14votes
1answers
2.7kviews

Guardrail prompt to stop an autonomous coding agent from running destructive commands

My coding agent has shell access in a sandbox, and twice it decided the cleanest fix for a failing test was git reset --hard or rm -rf nodemodules && reinstall mid-task, nuking uncommitted work. Sandb
16votes
2answers
4.0kviews

LLM-as-judge rubric prompt for scoring agent answers without grade inflation

I needed automated evals for an agent and reached for LLM-as-judge. First attempt: "rate this answer 1-10." Everything got a 7 or 8, the scores didn't correlate with human labels, and a slightly longe
35votes
1answers
3.4kviews

Context-engineering prompt for compacting an agent's long history without losing the thread

Long-running agents blow the context window. Naive truncation drops the early decisions that explain why the code looks the way it does, so the agent re-litigates settled choices. Summarizing the whol
22votes
0answers
2.3kviews

Planning-loop prompt that makes an agent decompose before it touches any tools

Our agents were too eager. Given a task they'd immediately start editing files, then discover halfway through that the approach was wrong and thrash. Latency and token cost ballooned from all the back
12votes
0answers
1.9kviews

Deterministic triage prompt for classifying inbound tickets into fixed buckets

I needed to route thousands of support tickets into a small set of categories for a dashboard. My first prompt was "classify this ticket" and it happily invented new categories every few hundred rows