匠人学院 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
Observability
On this page

Observability for Agent Workflows

A trace connects the user task to model calls, tool operations and the final artifact. Its purpose is to locate failures, not merely display a long activity feed.

#Record useful spans

Capture a run ID, parent operation, stage, start/end time, outcome and relevant configuration revision. For a tool, record the validated operation and its result status. For retrieval, record source IDs and index version. Avoid storing secrets or unnecessary personal text.

Distinguish a model timeout, invalid structured output, permission denial and a downstream service error. A generic “agent failed” counter cannot identify which layer needs repair.

#Measure the right latency and cost

Time to first output matters for an interactive screen; full completion matters for a finished artifact. Track both. Record model usage where the provider reports it, and identify estimates separately from actual billing.

A useful dashboard includes task completion rate, failures by stage, latency percentiles, retry counts and user feedback linked to a run. Do not treat every thumbs-up as evidence that an external action succeeded.

#Choose tools with data policy in mind

LangSmith and other tracing systems can help inspect orchestration. Local structured logs may be sufficient for a small workflow. Hosted traces can transmit prompts, tool results and documents; configure access, redaction and retention before enabling them.

#Debug from a failing result

Start with the final artifact or error and follow its run backward. Did retrieval find the right passage? Was the tool result passed to the next step? Did a retry duplicate a write? Preserve enough non-sensitive evidence to reproduce the boundary locally.

Test monitoring on deliberately failed fixtures and confirm an error appears once with the correct stage. An installed tracing SDK alone is not operational observability.

LangSmith documentation↗

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