Trajectory
A trajectory is an ordered record of states, actions, events, or operations showing how an agent or system progresses through an execution or process.
Designing AI Systems
A trace is a correlated record of a request's journey through a system, including its operations, timing, metadata, and nested work units across components.
- How it is used
- Connects service signals into a single-request view for production observability and bottleneck investigation.
- How deep it goes
- Defines the trace hierarchy and details context propagation, span assembly, service operations, and custom instrumentation.
- Examples
- Walks through a patient intake request and instruments a custom reranking operation.
- What you can do after
- Diagnose/debug slow requests by locating a bottleneck in a trace, inspecting correlated logs, and checking aggregate metrics.
Effective Platform Engineering
Tracing is the recording and analysis of request paths and spans across components of a distributed system.
- How it is used
- Diagnoses cross-process requests when metrics and logs alone cannot explain why an event occurred.
- How deep it goes
- Defines request-scoped events and sketches trace ingestion and correlation, but does not provide instrumentation code.
- Examples
- Illustrates diagnosis with HTTP-error metrics and API-call logs, and shows Tempo and Grafana as a tracing architecture.
- What you can do after
- Apply it via Tempo and Grafana to query trace data for distributed-system troubleshooting.
Read how Effective Platform Engineering explains trajectory →
Grokking AI Algorithms, Second Edition
An episode is a complete reinforcement-learning trial consisting of the states and actions from an initial state until a terminal outcome.
- How it is used
- Uses episodes to organize repeated reinforcement-learning trials and gather experience for training.
- How deep it goes
- Defines an episode and walks through simulator initialization, action selection, feedback, and per-step Q-table updates.
- Examples
- Illustrates episodes with a self-driving car simulation and a goal reached after 14 actions.
- What you can do after
- Understand how repeated trials and partial progress provide experience for learning action values.
Read how Grokking AI Algorithms, Second Edition explains trajectory →
Build a Multi-Agent System (from Scratch)
A trajectory, or rollout, is a record of an agent's task execution, including its actions and their results.
- How it is used
- Uses execution histories to support agent planning, debugging, and improvement while distinguishing them from final task results.
- How deep it goes
- Defines trajectories and implements per-step accumulation and formatting, while leaving some rollout implementation detail unexplored.
- Examples
- Illustrates rollouts with croissant searches, Hailstone tool calls, and a remote agent’s request for additional input.
- What you can do after
- Diagnose/debug agent executions by inspecting step boundaries, tool calls, results, and remote-agent interactions in the rollout.
Read how Build a Multi-Agent System (from Scratch) explains trajectory →
Quarkus in Action
Tracing data is telemetry describing the operations and timing of requests as they pass through application components and services.
- How it is used
- Uses request traces to troubleshoot failures and locate performance bottlenecks across components and services.
- How deep it goes
- Defines trace IDs, spans, nesting, and cross-service propagation, then sets up automatic collection rather than manual instrumentation.
- Examples
- Shows a product-creation trace with REST and database spans and a car-availability request’s span graph.
- What you can do after
- Operate/configure tracing with Quarkus OpenTelemetry and Jaeger to inspect request paths and operation timings.
AI Agents in Action, Second Edition
An execution history is a record of operations and attempts performed during an agent's task.
- How it is used
- Uses execution history and traces to make agent activity inspectable for debugging and improvement.
- How deep it goes
- Explains trace inspection and instrumentation, including named runs, correlation identifiers, and Phoenix setup.
- Examples
- Follows a research planner’s dependent tool calls and traces a named agent workflow.
- What you can do after
- Diagnose agent workflows with OpenAI Traces or Phoenix by inspecting calls, inputs, outputs, and timing.
Read how AI Agents in Action, Second Edition explains trajectory →
LLM Evaluation and Alignment, The Foundational Ideas
An execution trace is a chronological record of an agent's reasoning state, actions, retrieved results, and subsequent decisions.
- How it is used
- Uses trajectories to inspect agent decisions and supply rollouts for reinforcement learning and preference-based reward learning.
- How deep it goes
- Defines rollouts and details trace logging, stepwise evaluation, and segment-based preference labeling.
- Examples
- Uses a legal research agent’s weak search query and short Atari or MuJoCo simulation clips compared by annotators.
- What you can do after
- Diagnose/debug with it by inspecting intermediate agent decisions rather than relying only on the final answer.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains trajectory →
LLMs in Production
Model tracing is the capture of operations invoked during a model execution to construct an intermediate computational representation.
- How it is used
- Captures operations invoked during a model run to create an intermediate representation for later optimization and compilation.
- How deep it goes
- Defines tracing and demonstrates torch.jit.trace on a tokenized GPT-2 input.
- Examples
- Uses tokenized GPT-2 input and a CLIP example where text-only tracing prunes image operations.
- What you can do after
- Apply tracing with torch.jit.trace to produce a TorchScript representation for TensorRT compilation.
Optimization Algorithms: AI techniques for design, planning, and control problems
A sequence of states and actions generated during an agent's interaction with an environment.
- How it is used
- Frames the agent’s interaction history for evaluating policies and calculating cumulative return.
- How deep it goes
- Defines the state-action sequence and demonstrates collection through reset, action selection, stepping, reward accumulation, and termination.
- Examples
- Uses Reach the Treasure and CartPole episodes to illustrate discrete outcomes, observations, rewards, actions, and termination.
- What you can do after
- Apply it by collecting environment transitions, tracking episode rewards, and inspecting rollout statistics during A2C or PPO training.
Reinforcement Learning from Human Feedback
An episode is a finite sequence of interaction steps experienced by an agent during one trial.
- How it is used
- Connects episode-level interaction to expected-return optimization and language-model post-training.
- How deep it goes
- Defines trajectory probability and discounted return, then contrasts multistep RL with single-step RLHF; defers a full treatment of tool-use training.
- Examples
- Illustrates episodes with thermostat control and CartPole, and contrasts them with prompt-completion rollouts and tool-use traces.
- What you can do after
- Evaluate/understand how actions, transitions, and rewards contribute to a trajectory and its expected return.
Read how Reinforcement Learning from Human Feedback explains trajectory →
Evolutionary Deep Learning: Genetic algorithms and neural networks
An episode is one complete trajectory of interaction between a reinforcement-learning agent and its environment, from an initial state to termination.
- How it is used
- Organizes reinforcement-learning interaction into complete environment episodes for training and agent evaluation.
- How deep it goes
- Explains the reset-action-step loop and termination conditions, but stops short of formal trajectory notation or rollout distribution analysis.
- Examples
- Uses Frozen Lake episodes and Lunar Lander training episodes as concrete rollout examples.
- What you can do after
- Apply it via OpenAI Gym to run, record, train on, and evaluate complete agent-environment trajectories.
Read how Evolutionary Deep Learning: Genetic algorithms and neural networks explains trajectory →
AI Agents and Applications
Execution history is the recorded sequence of workflow decisions, transitions, and intermediate states produced during graph execution.
- How it is used
- Uses execution histories and traces to inspect agent workflows and troubleshoot unexpected behavior.
- How deep it goes
- Explains trace contents and inspection steps, and notes replay and branching from preserved workflow history.
- Examples
- Illustrates a trace of a beach-town recommendation agent and a research workflow that routes between search and synthesis.
- What you can do after
- Diagnose/debug with LangSmith by inspecting agent steps, tool calls, and handoffs for deviations or bottlenecks.
Applied Reinforcement Learning
A trajectory is a sampled sequence of states, actions, and outcomes generated by an agent interacting with an environment.
- How it is used
- Frames policy quality as expected cumulative reward across complete agent-environment runs.
- How deep it goes
- Defines state-action-reward sequences and discounted returns, then connects them to policy gradients; details trajectory collection only for REINFORCE.
- What you can do after
- Apply it via REINFORCE by collecting complete trajectories, computing returns, and increasing the probability of high-return runs.
Read how Applied Reinforcement Learning explains trajectory →
Generative AI in Action
Tracing is the technique of following a request through the operations and services involved in processing it.
- How it is used
- Tracks request routes as part of LLM application observability, helping locate bottlenecks and optimize processing.
- How deep it goes
- Defines request-route tracking and its diagnostic purpose, without detailing tracing implementation.
- Examples
- Identifies complex applications with multiple models or services and microservice-based architectures as tracing contexts.
- What you can do after
- Diagnose bottlenecks and problems by following request routes through applications and services.
Graph Neural Networks in Action
A time-ordered sequence of positions or states describing the evolution of an entity.
- How it is used
- Predicts future positions or motion from observed trajectories in dynamic graph problems such as pose estimation.
- How deep it goes
- Traces NRI encoding, recurrent decoding, training losses, and future-horizon evaluation without deriving the model mathematically.
- Examples
- Tracks a walking body’s sensor positions and velocities, then predicts node motion across future timesteps.
- What you can do after
- Predict future node trajectories by conditioning a recurrent decoder on inferred edge-type probabilities.
Read how Graph Neural Networks in Action explains trajectory →
Build a Reasoning Model (From Scratch)
A generated response trajectory sampled from the model, treated as one complete candidate output in policy optimization.
- How it is used
- Supports GRPO by generating candidate answers that are scored and compared before policy updates.
- How deep it goes
- Defines rollout as a complete generated answer, then shows sampling and downstream use in policy gradient loss.
- Examples
- Uses a chef analogy, a math prompt sampled with top-p and temperature, and several candidate answers.
- What you can do after
- Builds and samples complete candidate responses for GRPO training and later loss computation.
Read how Build a Reasoning Model (From Scratch) explains trajectory →
Designing AI Agents
A record of events and operations during a system run, arranged to show its progression and support diagnosis.
- How it is used
- Connects distributed agent events into a causal record for governance, diagnosis, and replay.
- How deep it goes
- Defines trajectory contents and correlation requirements, then details replay conditions, failure diagnosis, sampling, and fidelity limits.
- Examples
- Traces an excessive coupon through its proposal and policy gate, and localizes a lost identifier to a model-call handoff.
- What you can do after
- Diagnose agent failures by following evidence through proposals, policy decisions, tool responses, and resulting state.
Build an AI Agent (From Scratch)
An execution trace is a chronological record of events and intermediate activity produced during program or agent execution.
- How it is used
- Uses trajectories to evaluate how an agent reaches its goal, alongside its final output and component behavior.
- How deep it goes
- Explains trace structure and a review process from first-error analysis through failure taxonomy, rubric, and metrics.
- Examples
- Uses a marathon-to-Moon agent run and a falsely reported tool success to illustrate trace inspection and first-error analysis.
- What you can do after
- Diagnose/debug agent failures by inspecting execution traces and identifying the first error.
Read how Build an AI Agent (From Scratch) explains trajectory →
Google Anthos in Action
A rollout is the controlled deployment of a new application or service version and its progression toward the intended state.
- How it is used
- Advances an application release through target environments in a managed delivery pipeline.
- How deep it goes
- Details release creation, target promotion, and approval or rejection, without explaining rollout internals.
- Examples
- Uses a test-to-staging-to-production pipeline with optional manual promotion approvals.
- What you can do after
- Operate Google Cloud Deploy to create releases, promote rollouts, and approve or reject gated deployments.
gRPC Microservices in Go
Tracing records and correlates the path and timing of requests as they propagate through distributed components.
- How it is used
- Uses traces to follow requests across services and investigate latency in distributed systems.
- How deep it goes
- Defines traces and spans and explains gRPC span metadata, without detailing instrumentation setup.
- Examples
- Shows a PlaceOrder trace with database and Payment operations, plus gRPC span metadata.
- What you can do after
- Diagnose request latency by grouping operations with trace IDs and inspecting service-to-service flows.
100 Go Mistakes and How to Avoid Them
An execution tracer is a diagnostic tool that records runtime events such as scheduling, synchronization, and processor activity over time.
- How it is used
- Uses runtime traces to investigate performance, including garbage collection, goroutine execution, and poor parallelization.
- How deep it goes
- Explains event capture and timeline interpretation, including goroutine activity, CPU gaps, and garbage collection.
- Examples
- Compares traces from two parallel merge-sort implementations to expose goroutine overhead and differences in execution.
- What you can do after
- Diagnose poor parallelization by capturing and inspecting a Go execution trace.
Read how 100 Go Mistakes and How to Avoid Them explains trajectory →
Machine Learning Platform Engineering
Tracing is the recording and correlation of operations across a system to reveal execution paths, timings, and intermediate results.
- How it is used
- Makes LLM applications observable so teams can analyze behavior and optimize performance in production.
- How deep it goes
- Integrates callback instrumentation and business metadata to capture detailed traces.
- Examples
- Uses Langfuse with a DakkaBot RAG pipeline and a dashboard of traces, costs, and latency.
- What you can do after
- Diagnose poor answers by inspecting retrieval quality, prompt effectiveness, and reasoning chains.
Read how Machine Learning Platform Engineering explains trajectory →
Platform Engineering on Kubernetes
Tracing is the practice of recording and correlating the operations performed during a request across services and infrastructure.
- How it is used
- Uses tracing to understand distributed application behavior and performance and to help find problems.
- How deep it goes
- Explains service instrumentation and the OpenTelemetry collector architecture without detailing implementation steps.
- Examples
- Uses instrumented services sending telemetry to an OpenTelemetry collector as its architecture example.
- What you can do after
- Understand which services call other services or infrastructure and assess their performance.
Read how Platform Engineering on Kubernetes explains trajectory →
Context Engineering
A trace describes a request or operation’s flow across components, typically as a sequence of related spans.
- How it is used
- Tracks agent execution to inspect model and tool activity, retrieved context, latency, and token use.
- How deep it goes
- Defines traces as related spans and demonstrates Langfuse capture without specifying a trace schema.
- Examples
- Uses an agent run and a stale-pricing support incident to illustrate trace inspection.
- What you can do after
- Diagnose agent behavior by inspecting spans for model calls, tools, retrieved material, context, latency, and token counts.
Building LLM Applications with DSPy
A history of language-model calls, candidate prompts, and the model's responses.
- How it is used
- Uses execution histories to guide prompt optimization and lets evaluation metrics accept a trace that is None during evaluation.
- How deep it goes
- Defines traces and describes SIMBA comparing scored executions, without detailing the full trace data structure.
- Examples
- Contrasts a flight request mislabeled as a quantity inquiry with the correct booking-request classification.
- What you can do after
- Understand how an optimizer can compare execution histories and derive module-specific advice for future inputs.
Read how Building LLM Applications with DSPy explains trajectory →
Also covered in
- Cloud Observability in Action
- Troubleshooting Java, Second Edition
- Logs and Telemetry
- Crack Any Codebase with AIIn early access (MEAP)
- Grokking AI Applications
- Secure APIs
- Spring AI in Action
- Deep Learning with JAX
- Think Distributed Systems
- Elixir in Action, Third Edition
- Learn AI-Assisted Python Programming, Second Edition
- Fast by DefaultIn early access (MEAP)
What to know first
- OpenTelemetryOpenTelemetry is an open, vendor-neutral observability standard and framework for instrumenting software and generating, collecting, and exporting telemetry such as traces, metrics, and logs.
- AI agentAn AI agent is a computational system that uses artificial intelligence to interpret information and select or perform actions toward goals while interacting with an environment.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- stateState is information describing the condition or configuration of a system or computation at a particular time that may influence its behavior or subsequent transitions.
Related concepts
- spanhas part · A span is a record of an individual operation within a trace, including its timing, contextual information, and relationships to other operations.
- observabilitypart of · Observability is the ability to infer a system’s internal state and behavior from its externally available outputs, such as logs, metrics, and traces.
- Jaegeruses · Jaeger is an open-source distributed tracing system for collecting, storing, querying, and visualizing trace data to monitor and troubleshoot distributed applications.
- OpenTelemetryuses · OpenTelemetry is an open, vendor-neutral observability standard and framework for instrumenting software and generating, collecting, and exporting telemetry such as traces, metrics, and logs.
- subagentused by · A subagent is an agent assigned by another agent to perform a delegated part of a larger task under its coordination or authority.
- experience replayused by · A pattern that uses past execution trajectories and relevant parts of their history to guide later work.
Questions about trajectory
What is trajectory?
A trajectory is an ordered record of states, actions, events, or operations showing how an agent or system progresses through an execution or process.
Which Manning books explain trajectory?
Designing AI Systems, Effective Platform Engineering, Grokking AI Algorithms, Second Edition, Build a Multi-Agent System (from Scratch), Quarkus in Action, AI Agents in Action, Second Edition, LLM Evaluation and Alignment, The Foundational Ideas, LLMs in Production and 17 more.
What should I know before learning trajectory?
Manning books that teach trajectory usually introduce OpenTelemetry, AI agent, language model and state first.
What is trajectory part of?
Trajectory is part of observability. Observability is the ability to infer a system’s internal state and behavior from its externally available outputs, such as logs, metrics, and traces.
What are the parts of trajectory?
Trajectory includes span.
What is trajectory also called?
Trajectory is also called trace, rollout or execution history.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.
























