# How to Configure the Agent

Before we can record or mock requests, they must first be intercepted by the [agent](/core-concepts/agent.md). To do this, we can either setup the agent as a forward or reverse proxy.

{% hint style="info" %}
Some applications have their own proxy configurations e.g. Docker. Please refer to the application's documentation when applicable.
{% endhint %}

## Configuration Setups

We support two different setups for intercepting requests:

### Reverse Proxy

{% hint style="info" %}

#### Recommended for Single Upstream API

{% endhint %}

Use a reverse proxy when you have **one upstream API service** to intercept. This is the simplest setup as it routes all traffic for a specific domain through Stoobly.

**Best for:**

* Single API service
* Simple, straightforward routing
* When you want all requests to a domain intercepted

{% content-ref url="/pages/m8Aq4lu4QUh2Pgdy8CJz" %}
[Reverse Proxy](/guides/proxy-configuration/reverse-proxy.md)
{% endcontent-ref %}

### Forward Proxy with Filter Rules

{% hint style="info" %}

#### Recommended for multiple services

{% endhint %}

Use a forward proxy with [filter rules](/core-concepts/agent/proxy-settings/filter-rules.md) when you need to intercept requests to **multiple different services** or want fine-grained control over which requests are intercepted.

**Best for:**

* Multiple upstream API services
* Selective request interception
* Applications that make requests to various domains
* When you need to filter or exclude specific requests

With filter rules, you can:

* Include or exclude specific URL patterns
* Filter by HTTP method (GET, POST, etc.)
* Apply rules to specific modes (record, mock, replay)
* Control which requests get intercepted

{% content-ref url="/pages/Mt1ajQr0lhGVkalZFgWv" %}
[Forward Proxy](/guides/proxy-configuration/forward-proxy.md)
{% endcontent-ref %}

{% content-ref url="/pages/qs8imD4qtRLHTxh0jvvY" %}
[Filter Rules](/core-concepts/agent/proxy-settings/filter-rules.md)
{% endcontent-ref %}

## Verifying Setup

To verify successful setup of the agent, send a requests and check the logs to see if it was intercepted. For example, send a request with `curl https://docs.stoobly.com`, then in the agent logs you should see:

```
127.0.0.1:36368: GET https://docs.stoobly.com/ HTTP/2.0
     << HTTP/2.0 200 OK 263k
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stoobly.com/guides/proxy-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
