The Hard Part of AI Agents isn't Doing, It's Planning

Building an AI agent that performs tasks is easy. Building one that plans them correctly is hard.

I build a CLI where you type a sentence and an LLM runs actions on your real accounts. I use two modes: Direct mode and Plan mode.

Direct mode is for speed. Plan mode is for safety. In Plan mode, the agent shows you every step before it touches your data.

Here is how I built a reliable planner:

• Split the brain One agent cannot do both planning and execution. A planning agent wants to think. An execution agent wants to act. I separated them into two different agents with two different system prompts. This stops them from fighting each other.

• Give the agent eyes A planner that guesses is dangerous. My first version made up plans based on assumptions. Now, the planner uses read-only tools to research your data first. It looks at your actual Salesforce fields before it writes a single step.

• Prefill the answers Agents often ask bad questions. If they ask too many, you end up doing the work for them. I changed this. The planner still asks questions, but it provides a recommended answer. You just confirm or nudge it. This keeps the plan accurate without the manual data entry.

• Pass the context, not just the list If you only give an executor a list of steps, it loses the reasoning. I made the planner pass the assumptions and risks along with the steps. The executor now knows the "why" behind every action.

• Label the danger A plan is only safe if you can see the risks. My system marks destructive actions like deleting or renaming. When the agent hits a destructive step, it stops and asks you.

• Use data as the tiebreaker If an agent thinks a step failed and you tell it to retry, it doesn't just blindly obey. It checks the actual platform data. If the data shows the task is already done, the agent trusts the data over your claim.

The truth about safety: Plan mode does not stop prompt injection or a user who clicks "approve" without looking. It moves the responsibility from "trusting the model" to "trusting the human to review."

The structure provides the guardrails, but your review provides the final safety.

Source: https://dev.to/abdullahsaad5/the-hard-part-of-my-ai-agent-wasnt-doing-the-work-it-was-planning-it-n0k

Optional learning community: https://t.me/GyaanSetuAi