Skip to main content
Goals are available only on LangSmith Cloud. They are not available on self-hosted LangSmith or BYOC.
A goal tells LangSmith Engine what your agent should improve, such as answering more questions correctly or costing less per conversation. Engine focuses its recommendations on the goal and measures progress with a metric calculated from your traces. The metric’s chart shows whether your changes are working. You create a goal with LangSmith Chat, which reviews your recent traces and helps you define the goal, its metric, and how to track it.

How Engine uses goals

Goals give Engine a measurable definition of success. For each goal, Engine compares the traces that score best and worst on the goal’s metric to find what separates them. For example, for a goal to increase the percentage of emails sent without edits, Engine looks at how the agent behaves differently on emails users accepted and emails they changed. Engine files its findings under the goal as recommendations, which can fix bugs, streamline inefficient workflows, or close gaps between what the agent does and what users want. The Engine page groups recommendations by goal. Recommendations that are not filed under a goal appear under General. Engine still makes recommendations outside your goals, so a goal focuses Engine without hiding its other findings.

Before you begin

  • You can create a goal while you set up Engine for an agent environment, or any time after.
  • Creating a goal requires a Workspace Admin or Workspace Editor role, or a custom role that includes issues:create and issues:update. Editing a goal through Chat also requires both, and deleting a goal requires issues:delete.
Each active goal in an agent environment needs its own metric. Two active goals in the same agent environment cannot use the same metric.

Create a goal

1

Open the goal chat

Select your agent and go to Engine. Select the environment from the environment switcher at the top of the page. Under Goals on the overview, click Create a goal.While Engine runs its first analysis after setup, you can also create a goal from the analysis screen. Click Create goal, or Create a new goal if the agent environment already has a goal.
2

Choose what to improve

Chat analyzes your agent’s recent traces and suggests goals. Choose one of the suggestions, or describe what you want your agent to improve in your own words. Chat may ask a clarifying question when the answer changes the goal or how it is measured.Once you choose, Chat proposes the goal’s name and description, and LangSmith saves the goal as a draft. Drafts are visible to everyone with access to the agent environment, and anyone who can edit goals can continue, activate, or delete a draft.
3

Choose how to measure it

Chat recommends metrics for the goal, or you can describe how you want to measure it. The metric appears under How we measure this in the goal preview beside the chat. For the kinds of metrics available, see Choose a metric.
4

Set up tracking

If your traces do not already record the metric, choose how to record it under Tracking. See Set up tracking. You can also choose Skip for now and add tracking later.
5

Create the goal

Click Create goal. The goal becomes active and appears on the overview for everyone with access to the agent environment. Engine then looks through its open recommendations from the last week that are not filed under a goal, and files the ones that fit the new goal under it. The goal shows Finding relevant recommendations while this runs.
To change the goal, metric, or tracking before you create the goal, click Edit next to that step in the goal preview, or tell Chat what to change. If Chat finds that an open goal already covers your request, it offers to use or edit that goal, or to create a separate one. The goal chat counts as Engine usage. If your organization or agent environment has reached its spend limit, you cannot use the goal chat until the limit is raised or the next billing period begins.

Choose a metric

A goal’s metric is one number that shows your progress toward the goal. Depending on the goal, progress means the metric goes up, such as a success rate, or down, such as cost. A metric can read:
  • Built-in values: Cost, latency, time to first token, or tokens, which every run records. Conversations also record the number of turns.
  • Feedback: A score that an online evaluator, your application, or a reviewer writes. A pass or fail score reports a rate, and a numeric score reports an average or a percentile.
  • Conditions: The rate or count of units that match a filter, such as tool calls that end in an error, or conversations that include a successful booking.
  • Counts: How many runs occur, in total or per trace or conversation, such as model calls per trace.
For example:
  • Fewer escalations: The rate of traces with a pass or fail escalated feedback score that your application writes when a request escalates.
  • Lower cost per conversation: The average cost of a conversation.
  • Fewer conversations with a failed tool call: The rate of conversations that contain a tool run that ended in an error.
Some outcomes arrive after a trace ends, such as whether a pull request your agent opened was merged. Chat can mark the last few days (up to 7) of such a metric as still settling, so the chart does not report them as final.

Set up tracking

The setup a metric needs depends on where its data comes from:
  • Already on your traces: No setup is needed for built-in values, run names, inputs, outputs, statuses, metadata, or feedback that an evaluator, your application, or a reviewer already writes. The Tracking step shows Already on your traces or Recorded on every run.
  • Computed by an evaluator: If an evaluator can score the metric on each run or conversation, Chat drafts an online evaluator and usually tests it on recent runs. Review the draft. To fill in the goal’s chart right away, choose the last 3, 7, or 14 days under Score past runs (Score past threads for a conversation metric). Then click Create evaluator. The evaluator scores matching traces in the background, and the goal shows Scoring past runs… until it finishes the past ones.
  • Recorded by your code: When the outcome is not on your traces, such as a closed deal, code has to record it. Choose one of:
    • Have Engine generate a PR: Engine files a tracking recommendation under the goal and opens a pull request that records the signal in your agent’s code. This requires a connected repository.
    • I’ll add it myself: Get instructions and code to add to your agent.
    • Skip for now: Create the goal without tracking and set it up later.
You do not need to wait for metric data before you create a goal. LangSmith keeps checking for data in the background. To change a tracking choice later, click Edit next to Tracking on the goal’s page, or Add tracking on a goal whose tracking you skipped.

Track progress

On the overview, each active goal shows a 14-day chart of its metric and compares the most recent settled week with the week before. Click a goal to open its page, which shows the chart and the recommendations filed under the goal. When a goal has no chart, a badge shows what it is waiting on:
  • Not tracked: No tracking is set up, or the evaluator or pull request that records the metric is not in place yet. Click Add tracking or Review tracking to finish setup.
  • Waiting for data: Tracking is in place, and the metric has not arrived on new traces yet.
  • Couldn’t check: LangSmith could not read the goal’s data. Click Try again on the goal.
If a goal’s metric stops arriving, for example because an evaluator was deleted or turned off, the goal offers the same setup steps again.

Manage goals

To manage a goal, click the More goal actions icon on the goal’s card on the overview, then select an action. On the goal’s page, click Edit or Mark as completed at the top, or click More goal actions for Delete:
  • Edit: Reopen the goal chat to change the metric or tracking. On an active goal, Chat’s proposals wait until you click Save changes. A goal’s name and description cannot change after you create it. To pursue a different outcome, mark the goal as completed or delete it, then create a new one.
  • Mark as completed: Move the goal and its recommendations off the active board. To review a completed goal and its recommendation history, click View completed goals on the overview.
  • Delete: Permanently delete the goal. Its recommendations move to General. This cannot be undone.

See also