liveBook · Manning

Trajectory

As explained in AI Agents and Applications

Execution history is the recorded sequence of workflow decisions, transitions, and intermediate states produced during graph execution.

A trajectory is the execution history of a workflow: the decisions it made, the steps it took, and the intermediate states it produced. The final answer alone cannot show whether a research workflow searched again because its first results were insufficient, or which agent handled a customer request. section 5.6 section 12.4

There are two practical ways to inspect that history:

  • In a LangGraph workflow, typed state accumulates across nodes, while conditional edges determine the next step. Preserved execution history lets you inspect a reasoning path, replay from a checkpoint, or branch from an earlier decision. section 5.6
  • In LangSmith, a trace makes an agent run visible through its LLM steps, tool calls, message flow and intermediate states. Enable tracing with a LangSmith API key and tracing configuration, rerun the application, then open its latest trace. section 11.9.3 section 11.9.4

Diagnosing a wrong handoff

Suppose a customer-service router sends a billing question to a support agent. Inspect the trace to see which agent received the query, what tools it called, and where the handoff occurred. Tracking current_agent and agent_history in state also makes the sequence of handlers visible. section 12.4

Figure 11.4 LangSmith agent execution trace. This trace visualizes each step of the agent’s workflow—including LLM calls, tool invocations, and message flow—when answering the prompt, “Suggest two Cornwall beach towns with nice weather.”
figure

The graphical agent trace provides a concrete view of LLM calls, tool invocations and message flow during one response. section 11.9.4

How AI Agents and Applications covers it

How deep it goes
Explains state accumulation and conditional routing, then gives tracing setup and inspection steps without detailing trace storage internals.
Examples
Uses a research workflow that may repeat search, an agent execution trace, and customer-service routing with recorded agent handoffs.
What it assumes
Assumes a running workflow or agent to inspect; introduces tracing through configuration and a concrete trace-navigation procedure.
What you can do after
Diagnose/debug with it by inspecting reasoning paths, replaying from checkpoints, or tracing incorrect tool choices and slow calls.
How it connects
Connects trajectories to LangGraph state, conditional edges, checkpoints, LangSmith traces, tool calls and multi-agent routing.

Also explained in

Compare how 19 books explain trajectory →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents and Applications. The section links point to the parts of the book it draws on.