匠人学院 JR Academy
Skip to article
Engineering handbook
AI Agent Engineering Handbook

Start with tool calls. Understand how an agent acts, reads observations and stops when something fails. Verify each boundary with complete code and offline tests.

5 chapters·16 guides·Open access
Planning and Reasoning
On this page

Planning and Replanning

Planning turns an objective into steps whose results can be checked. For an agent, the plan must change when an observation contradicts its assumptions.

#Start with dependencies

For a coding task, locate the repository and reproduce the issue before editing. For research, collect sources before writing factual conclusions. Put the hardest dependency to verify near the beginning so a blocked task fails early.

An explicit task record can be simple:

json
{ "objective": "Repair a local document-loading failure", "steps": [ {"id": "reproduce", "state": "done", "evidence": "saved failing response"}, {"id": "repair", "state": "in_progress", "depends_on": ["reproduce"]}, {"id": "verify", "state": "pending", "depends_on": ["repair"]} ], "constraints": ["local only", "preserve existing URLs"], "max_attempts_per_step": 2 }

This is illustrative state, not a claim that those operations were executed.

#Choose the lightest reasoning pattern

A fixed workflow is suitable when the steps are known. Hierarchical planning helps split a large objective into smaller deliverables. Exploring several candidate approaches can help when there are genuine alternatives, but adds latency and usage.

Request a concise plan, assumptions and verification criteria. Do not depend on a hidden chain-of-thought transcript as an application interface. Observable actions and results are what the runtime can validate.

#Replan after evidence

If a test fails, record the error, identify which assumption changed and revise the next action. Repeating the same unsuccessful tool call without new information is not progress. Limit retries and distinguish transient failures from missing authorization or unavailable data.

Reflection is useful only when it changes an action or improves a check. A long self-critique does not prove the artifact is correct. Finish with the actual deliverable, its verification result and any unresolved constraint.

Stateful workflows

System Design

Core system design concepts and practical case studies

Learn the trade-offs and patterns that matter in technical interviews.

Open System Design →

FAQ

Which language should I use?
Python and TypeScript both work. Start with the language you can debug; the first exercise uses Python 3.10+ and its standard library.
Does MCP require a specific model?
No. MCP connects applications to tools and context services. Compatibility depends on the host client, transport, protocol version and authorisation; model tool-calling support is a separate check.
Does learning agents guarantee employment?
No. Use a small project to demonstrate requirements analysis, permissions, testing and maintenance. Employment outcomes depend on the role market and your actual skills.

Done reading? Next steps