> ## Documentation Index
> Fetch the complete documentation index at: https://docs.costgraph.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Goals and runs

> Create a workflow goal, set its schedule and limits, and follow, steer, retry, or cancel its runs

A goal tells the agent what to work on and sets the limits it works within.
Each time the goal runs, the agent reads your data, plans, and proposes the
changes that meet the goal. See [Workflows](/costgraph/workflows/overview) for
how goals, runs, and approvals fit together.

## Before you begin

* An admin or organization owner role.
* To change resources outside CostGraph, a connected tool. See
  [Connected tools](/costgraph/workflows/overview#connected-tools).

## Create a goal

<Steps>
  <Step title="Open a new goal">
    Go to **Workflows** and click **New goal**.
  </Step>

  <Step title="Describe the work">
    Enter a **Goal name**, then describe the work in plain words in the box
    that follows. Say what good looks like.
  </Step>

  <Step title="Set the limits">
    Pick the **Connected tools** the agent may use, what it may change, any
    tag exclusions, the schedule, and the active-time limit. The following
    table describes each setting.
  </Step>

  <Step title="Create the goal">
    Check the summary under **This goal will**, then click **Create goal**. A
    goal that runs once starts its first run right away.
  </Step>
</Steps>

Each setting limits what the agent can do:

| Setting | What it does |
| - | - |
| **Connected tools** | The only outside tools the agent can use. With none, it uses CostGraph data only |
| **What it may change** | The kinds of change the agent may propose, such as **Budgets** or **Compute**. Anything not picked stays read only |
| **Tag exclusions** | The agent never touches a resource that carries one of these tags. Leave the value empty to match any value |
| **Schedule** | **Once**, **Daily**, **Weekly**, or **Monthly**, at a local time in a time zone |
| **Active-time limit** | How long a run can work, from 1 minute to 24 hours. Time queued or waiting for you doesn't count |
| **When it finds a change** | **Ask before every change**, or **Allow certified low-risk changes** |

The full list of changes, and the kind of change each one needs, is on
[What workflows can change](/costgraph/workflows/what-workflows-can-change).

## Schedules

A goal that runs **Once** starts as soon as you create it. A recurring goal
first runs at its next scheduled time.

A monthly goal runs on a weekday in a given week of the month, such as the
first Monday. Months without a fifth occurrence of that weekday skip a run
set for the fifth week.

To stop a recurring goal for a while, open its actions on the **Overview**
tab and select **Pause schedule**. **Resume schedule** turns it back on.

## Approval setting

**Ask before every change** makes every change wait for your approval.

**Allow certified low-risk changes** lets a change go ahead on its own only
when CostGraph certifies it as low risk and reversible. Every other change
still waits. No change a workflow can make today carries that certification,
so both settings ask before every change.

## What a run does

A run works in steps that you can follow on its page:

1. The agent reads the evidence: cost, recommendations, anomalies, Kubernetes
   state, and the records and resources the goal involves.
2. It writes a plan and shows the steps it expects to take.
3. For each change, it asks for approval. See
   [Approvals](/costgraph/workflows/approvals).
4. After you approve, CostGraph applies the change once, then reads the record
   or resource again to confirm it took effect.
5. The agent finishes with a summary of what it found, what changed, and
   anything you need to do.

The agent can also ask you a question or ask you to choose between options.
The run waits until an admin or organization owner answers.

## Run states

Each run shows one of the following states:

| State | Meaning |
| - | - |
| **Queued** | Waiting to start. Nothing has been read or changed yet |
| **Working** | The agent is working on the next step |
| **Waiting** | The agent paused before its next step |
| **Needs you** | A change or a question is waiting for an admin or organization owner |
| **Needs access** | A connected tool needs to be reconnected or given a permission |
| **Completed** | The run finished |
| **Nothing to do** | The agent checked and found no change worth making |
| **Blocked** | The run could not continue without something from you |
| **Failed** | The run stopped because of an error |
| **Timed out** | The run reached its active-time limit |
| **Cancelled** | Someone cancelled the run |

## Steer a run

While a run works, you can message the agent from the run page, for example
"leave the staging account alone". Guidance applies to that run only and
doesn't change the goal. If the agent suggests a rule worth keeping, click
**Save to goal** to apply it to future runs.

After a run finishes, send a message to ask for a follow-up. A follow-up starts
a new run of the same goal.

## Manage runs and goals

* **Run now** starts a new run from the goal's current settings.
* **Cancel run** stops a run in progress. Nothing else changes in that run.
* **Retry run** starts a new run with the same goal settings. It's available
  when a run failed, was blocked, was cancelled, or timed out.
* **Edit goal** saves a new version of the goal. A run already in progress
  keeps the settings it started with, and editing doesn't start a run.
* **Delete** removes the goal from Workflows and stops any run in progress.

## Run history

The **Runs** tab lists every run with its goal, status, start time, and how
long it took. Search goals and summaries, or filter by status and by trigger:
**Scheduled**, **Manual**, **Retries**, or **Follow-ups**.

## Next steps

<CardGroup cols={2}>
  <Card title="Approvals" icon="circle-check" href="/costgraph/workflows/approvals">
    Review, approve, or reject a change.
  </Card>

  <Card title="What workflows can change" icon="list-check" href="/costgraph/workflows/what-workflows-can-change">
    Every change a workflow can make.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.