---
title: Use Optimizely Agent
slug: feature-experimentation/docs/use-optimizely-agent
docTags: 
createdAt: 2026-08-05T20:39:53.000Z
---

Optimizely Agent provides equivalent functionality to the language-specific SDKs. At Optimizely Agent's core is the [Optimizely Go SDK](docId\:cYszFGowa-s5uMfWEvWbP).

## Run feature flag rules

The [Decide endpoint](docId\:xMaNHICTvsYdQIJDZ8cg7) buckets a user into a feature flag variation as part of a [flag rule](docId:-yq2-thNRv7-SgwCXpG90). It chooses between multiple enabled or one disabled variation for a flag. Flag rules include A/B tests and targeted feature flag deliveries. To run a flag rule, use the following:

`POST /v1/decide?keys={flagKey}`

In the request `application/json` body, include the `userId` and any `decideOptions`. The full request looks like

```curl
curl --location --request POST 'http://localhost:8080/v1/decide?keys=YOUR_FLAG_1&keys=YOUR_FLAG_2' \
--header 'X-Optimizely-SDK-Key: YOUR_SDK_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"decideOptions": [
    "ENABLED_FLAGS_ONLY",
    "INCLUDE_REASONS"
],
"userId": "string",
"userAttributes": {
   "additionalProp1": {}
  }
}'
```

This returns an array of [OptimizelyDecision](docId\:bAl3piZKbSaDKyKI7TlBE) objects that contain all the information you need to run your flag rule, such as:

- The decision to bucket this user into an enabled or disabled feature flag variation.
- Any corresponding feature flag variable values.

For example:

```json
{
	"userContext": {
        "UserId": "test-user",
        "Attributes": {
            "logged-in": true,
            "location": "usa"
        }
    },
    "flagKey": "my-feature-flag",
    "ruleKey": "my-a-b-test",
	  "enabled": false,
    "variationKey": "control_variation",
	"variables": {
		"my-var-1": "cust-val-default-1",
		"my-var-2": "cust-va1-default-2"
	},
    "reasons": []
}
```

The response is determined by the [A/B tests](docId:8pnfCv-sR37goLcxTtCPv) and [targeted deliveries](docId:_BjMxuGwwlVrhkNcx2kzm) defined for the supplied feature key, following the same rules as any Optimizely Feature Experimentation SDK.

:::hint{type="warning"}
**Important**
If the user is bucketed into an A/B test, this endpoint dispatches a decision event.
:::

## Authentication

To authenticate, pass your SDK key as a header named `X-Optimizely-SDK-Key` in your API calls to Optimizely Agent. You can find your SDK key in [app.optimizely.com](https://app.optimizely.com) under **Settings** > **Environments** > **SDK Key**. Remember each environment has its own SDK key.

## Get all decisions

- To get all feature flag decisions for a user in a single request, omit the feature flag parameter:
  `POST /v1/decide`
- To get decisions for multiple keys, specify multiple keys parameters, for example:
  `keys=flag_key_1&keys=flag_key_2`
- To receive only the enabled feature flags for a user use a decide option in the `application/json` request body:

```curl
--header 'Content-Type: application/json' \
--data-raw '{
   "userId": "test-user",
   "decideOptions": [
      "ENABLED_FLAGS_ONLY"
   ]
}'
```

## Track conversions

To track events, use the [tracking endpoint](docId\:EhL-Wif0UjdVLtOmYQKyl):

`POST /v1/track?eventKey={eventKey}`

There is no response body for successful conversion event requests.

## API reference

For more details on Optimizely Agent's APIs, see the [complete Agent API Reference](docId:70orYTjk-9148MF1hp0KK).
