> For clean Markdown of any page, append `.md` to the page URL.
> For a complete documentation index, see https://docs.sarvam.ai/llms.txt.
> For full documentation content in one file, see https://docs.sarvam.ai/llms-full.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.sarvam.ai/_mcp/server.

# Building & improving agents

Building a production agent is a loop, not a one-shot. This page lays out the path from a first draft to a deployed agent you keep improving with real traffic.

#### Build the first version

Start with a [single-state agent](/conversations/build/single-state-agents): a clear [instruction](/conversations/build/system-prompt), a [voice and language](/conversations/build/voice-language), and only the [tools](/conversations/build/tools) the core flow needs. Resist adding states or tools you can't yet test.

#### Review & test the prompt

Test every change before it ships:

* **test agent**: talk to the agent live and listen for turn-taking, language, and tone.
* **Simulate**: run scripted / simulated conversations to check behaviour repeatably.

#### Set up outcome variables

Define the [output variables](/conversations/build/variables-personalization) that capture what happened, disposition, resolution, collected fields, and the [goal](#goals) that judges success. These are what you'll measure and improve against.

#### Deploy

Ship the agent to a channel, [telephony](/conversations/deploy/telephony), a web [widget](/conversations/deploy/deploy-with-code), or [code](/conversations/deploy/deploy-with-code), deliberately, from a tested config version.

#### Set up key metrics & dashboards

Wire up [Agent Analytics](/conversations/monitor/agent-analytics) and build the [boards](/conversations/monitor/boards) you'll watch: connectivity, engagement, outcomes, and the business metric that actually matters.

#### Improve

Use call logs, transcripts, and outcome metrics to find where the agent fails, tighten the prompt or tools, re-test, and roll forward. Repeat.

## Goals

A **goal** is the success criterion for an agent. It powers automated conversation evaluation against both live and test agent traffic, and its results feed the [Goals dashboard](/conversations/monitor/agent-analytics/goals) in Agent Analytics.

You can set **one goal per agent**. Keep it focused on the single business outcome that defines success; use [Agent Analytics](/conversations/monitor/agent-analytics) for broader operational metrics.

### Rule-based conditions

A goal is built from rules that check conversation outcomes - for example whether a required variable was set, whether a disposition matches an expected value, or whether a numeric score clears a threshold.

| Operator     | Meaning           |
| ------------ | ----------------- |
| `equals`     | Exact match       |
| `not_equals` | Not equal         |
| `in`         | Value is in a set |
| `gt`         | Greater than      |
| `lt`         | Less than         |

Additional operators may appear in the dashboard as the evaluation system expands.

### See the results

Once a goal is configured, every connected call is evaluated against it. The outcomes appear in the [Goals tab](/conversations/monitor/agent-analytics/goals) under Agent Analytics - achievement rate, achieved-vs-not cohorts, and the patterns that correlate with success.