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

# Getting Started with Agent Endpoints and Traffic Policy via Configuration File

> Learn how to set up an Agent Endpoint with a custom Traffic Policy using the ngrok agent configuration file.

The following getting started guide will take you through starting an Agent Endpoint with a Traffic Policy applied via the [Agent Configuration File](/docs/gateway/agent/config/). Note, this guide requires that your agent configuration file is set to [v3](/docs/gateway/agent/config/v3).

## What you'll need

* An [ngrok account](https://dashboard.ngrok.com/).
* The [ngrok Agent CLI](https://ngrok.com/download) installed.

## 1. Edit your ngrok configuration file

Enter the following command into your terminal:

```bash theme={null}
ngrok config edit
```

In your configuration file, add the following content to the bottom and save the file:

```yaml theme={null}
endpoints:
  - name: my-agent-endpoint
    description: My first Agent Endpoint with a Traffic Policy
    upstream:
      url: 80
    traffic_policy:
      on_http_request:
        - actions:
            - type: custom-response
              config:
                status_code: 200
                body: "Hello, World!"
```

This policy will respond to each HTTP request with “Hello, World!"

<Note>
  Your configuration file `version` must be set to `3`.
</Note>

## 2. Start your Agent Endpoint

Start your Agent Endpoint by running the following command:

```bash theme={null}
ngrok start my-agent-endpoint
```

This command will start an HTTP tunnel for port `80`, using the specified Traffic Policy in the config file to manage traffic.

## 3. Test it out

After running the ngrok command in the previous step you should now see a URL in the forwarding section. Open the URL in your web browser. You should see the "Hello, World!" message displayed in your browser.

## What's next?

You've now successfully set up your first Agent Endpoint with a custom Traffic Policy using the ngrok agent configuration file.

To learn more about ngrok's Traffic Policy and its capabilities, check out the following resources:

* Learn about the [core concepts](/docs/gateway/traffic-policy/how-it-works) like phases and rules.
* Check out the [examples, use-cases and guides](/docs/gateway/traffic-policy/examples/a-b-tests/).
* The list of [available actions](/docs/gateway/traffic-policy/actions/), [macros](/docs/gateway/traffic-policy/macros/) and [variables](/docs/gateway/traffic-policy/variables/) you can use.
