Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKGet startedIntroductionInstallationQuickstartModulesModel I/â€‹OData connectionChainsMemoryAgentsCallbacksModulesGuidesEvaluationString EvaluatorsComparison EvaluatorsTrajectory EvaluatorsCustom Trajectory EvaluatorAgent TrajectoryExamplesDebuggingDeploymentLangSmithModel ComparisonEcosystemAdditional resourcesGuidesEvaluationTrajectory EvaluatorsAgent TrajectoryOn this pageAgent TrajectoryAgents can be difficult to holistically evaluate due to the breadth of actions and generation they can make. We recommend using multiple evaluation techniques appropriate to your use case. One way to evaluate an agent is to look at the whole trajectory of actions taken along with their responses.Evaluators that do this can implement the AgentTrajectoryEvaluator interface. This walkthrough will show how to use the trajectory evaluator to grade  an OpenAI functions agent.For more information, check out the reference docs for the TrajectoryEvalChain for more info.from langchain.evaluation import load_evaluatorevaluator = load_evaluator("trajectory")Capturing Trajectoryâ€‹The easiest way to return an agent's trajectory (without using tracing callbacks like those in LangSmith) for evaluation is to initialize the agent with return_intermediate_steps=True.Below, create an example agent we will call to evaluate.import osfrom langchain.chat_models import ChatOpenAIfrom langchain.tools import toolfrom langchain.agents import AgentType, initialize_agentfrom pydantic import HttpUrlimport subprocessfrom urllib.parse import urlparse@tooldef ping(url: HttpUrl, return_error: bool) -> str:    """Ping the fully specified url. Must include https:// in the url."""    hostname = urlparse(str(url)).netloc    completed_process = subprocess.run(        ["ping", "-c", "1", hostname],