---
title: "Create an AI Gateway Agent"
method: POST
path: "/v1/ai-gateways/{gatewayId}/agents"
tags: ["AI Gateway Agents"]
---

# Create an AI Gateway Agent

`POST /v1/ai-gateways/{gatewayId}/agents`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v1/ai-gateways/{gatewayId}/agents`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

Creates a new agent for the AI Gateway.

## Path parameters

- `gatewayId` string, uuid, required: Contains a unique identifier used for this resource.

## Request body

- CreateAIGatewayAgentRequest
  - `display_name` string, required: The display name for this agent.
  - `name` string, required: A user-defined unique identifier for this agent, used as a stable human-readable reference. This value is immutable after creation.
  - `enabled` boolean: Whether the Agent is enabled.
  - `type` 'a2a' | 'http', required: The type of the agent.
  - `policies` string[]: List of policy references.
  - `access` AIGatewayAgentAccess: Access control configuration for an agent.
    - `acls` AIGatewayACLS: Access control rules. Configure exactly one of `allow`, `deny`, `allow_when`, or `deny_when`.
      - `allow` string[]: List of Consumer Groups Names, or Authenticated Groups Names that are permitted access.
      - `deny` string[]: List of Consumer Groups Names, or Authenticated Groups Names that are denied access.
      - `allow_when` string[], nullable: Allow the request if it matches any of these CEL boolean expressions evaluated against the request context (consumer, principal, HTTP attributes, consumer groups, etc.). Exactly one of `allow`, `deny`, `allow_when`, or `deny_when` must be specified.
      - `deny_when` string[], nullable: Deny the request if it matches any of these CEL boolean expressions evaluated against the request context (consumer, principal, HTTP attributes, consumer groups, etc.). Exactly one of `allow`, `deny`, `allow_when`, or `deny_when` must be specified.
    - `identity_providers` AIGatewayIdentityProviderReference[]: List of identity providers for granting access to the agent. At most 1 identity provider of each identity provider type can be referenced. Deprecated: use `auth_strategies` instead. The two are mutually exclusive.
    - `auth_strategies` AIGatewayAuthStrategyReference[]: List of auth strategies for granting access to the agent. At most 1 auth strategy of each auth strategy type can be referenced.
  - `config` object, required: Configuration for the agent. The structure varies depending on the agent type.
    - `url` string, uri, nullable: Helper field to set protocol, host, port and path of the upstream A2A Agent using a URL. This is the same as a Kong Gateway Service URL: ${scheme}://${host}:${port}/${path}
    - `upstream` AIGatewayUpstreamConfig: Configuration applied when proxying to the upstream service, including authentication.
      - `auth` AIGatewayUpstreamAuthAWS: AWS IAM (SigV4) authentication for the upstream service.
        - `type` 'aws', required
        - `access_key_id` string: The access key id for authenticating with static IAM User credentials. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `secret_access_key` string: The secret access key for authenticating with static IAM User credentials. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `session_token` string: The session token for authenticating with temporary IAM credentials. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `region` string: The AWS region of the upstream service. Overrides the region inferred from the environment.
        - `assume_role_arn` string: The ARN of the IAM role to assume for generating authentication tokens. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `role_session_name` string: The session name for the temporary credentials when assuming the IAM role. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `sts_endpoint_url` string: The STS endpoint URL to use for generating authentication tokens. If not specified, the default AWS STS endpoint will be used.
    - `route` AIGatewayRouteConfig: Configuration for an AI Gateway route.
      - `headers` object: One or more lists of values indexed by header name that will cause this route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression.
      - `hosts` string[]: A list of domain names that match this route. Note that the hosts value is case sensitive.
      - `https_redirect_status_code` integer: The status code Kong responds with when all properties of a route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the route is configured to only accept the `https` protocol.
      - `methods` string[]: A list of HTTP methods that match this route.
      - `paths` string[]: A list of paths that match this route.
      - `preserve_host` boolean: When matching a route via one of the `hosts` domain names, use the request `Host` header in the upstream request headers. If set to `false`, the upstream `Host` header will be that of the service's `host`.
      - `protocols` string[]: An array of the protocols this route should allow. See the [route Object](#route-object) section for a list of accepted protocols. When set to only `https`, HTTP requests are answered with an upgrade error. When set to only `http`, HTTPS requests are answered with an error.
      - `regex_priority` integer: A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same `regex_priority`, the older one (lowest `created_at`) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones).
      - `request_buffering` boolean: Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding.
      - `response_buffering` boolean: Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding.
      - `strip_path` boolean: When matching a route via one of the `paths`, strip the matching prefix from the upstream request URL.
      - `tags` string[]: An optional set of strings associated with the route for grouping and filtering.
    - `proxy` AIGatewayProxyConfig: HTTP/HTTPS proxy configuration for outbound requests to the upstream AI provider.
      - `http_proxy` object, nullable: HTTP proxy server to route plaintext outbound requests through.
        - `host` string, nullable: A string representing a host name, such as example.com.
        - `port` integer, nullable: An integer representing a port number between 0 and 65535, inclusive.
      - `https_proxy` object, nullable: HTTPS proxy server to route TLS outbound requests through.
        - `host` string, nullable: A string representing a host name, such as example.com.
        - `port` integer, nullable: An integer representing a port number between 0 and 65535, inclusive.
      - `proxy_scheme` 'http': The proxy scheme to use when connecting to the proxy server.
      - `auth` object, nullable: Credentials used to authenticate to the proxy server.
        - `username` string, nullable: The username to use for proxy authentication. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `password` string, nullable: The password to use for proxy authentication. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
      - `no_proxy` string, nullable: Comma-separated list of hosts that should not be proxied.
    - `max_request_body_size` integer: Maximum size of request body to parse. Set to 0 for unlimited.
    - `logging` object: Configuration for AI Gateway logging.
      - `payloads` boolean
      - `max_payload_size` integer: Maximum size in bytes for logged request/response payloads. Payloads exceeding this size will be truncated.
    - `certificates` AIGatewayCertificateReference[]: Client certificates used for mutual TLS (mTLS) authentication with the upstream agent endpoint, referenced by name. Each entry must be the `name` of an existing AI Certificate on the same AI Gateway. The certificates are applied to the Kong Gateway Service generated for this Agent, which proxies requests to `config.url`. The generated Service presents a single client certificate (`client_certificate`) during the TLS handshake with the upstream, so at most one certificate may be configured. If unset, no client certificate is presented to the upstream.
    - `ca_certificates` AIGatewayCACertificateReference[]: CA certificates used to verify the TLS certificate of the upstream agent endpoint, referenced by name. Each entry must be the `name` of an existing AI CA Certificate on the same AI Gateway. The CA certificates build the trust store (`ca_certificates`) of the Kong Gateway Service generated for this Agent, which proxies requests to `config.url`. If unset, the default trust store is used to verify the upstream's TLS certificate.
  - `labels` PublicLabels: Public labels store information about an entity that can be used for filtering a list of objects. Public labels are intended to store **PUBLIC** metadata. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
  - `managed_by` ManagedBy: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.

## Response `201`

AI Agent created successfully.

- AIGatewayAgent
  - `display_name` string, required: The display name for this agent.
  - `name` string, required: A user-defined unique identifier for this agent, used as a stable human-readable reference. This value is immutable after creation.
  - `enabled` boolean: Whether the Agent is enabled.
  - `type` 'a2a' | 'http', required: The type of the agent.
  - `policies` string[]: List of policy references.
  - `access` AIGatewayAgentAccess: Access control configuration for an agent.
    - `acls` AIGatewayACLS: Access control rules. Configure exactly one of `allow`, `deny`, `allow_when`, or `deny_when`.
      - `allow` string[]: List of Consumer Groups Names, or Authenticated Groups Names that are permitted access.
      - `deny` string[]: List of Consumer Groups Names, or Authenticated Groups Names that are denied access.
      - `allow_when` string[], nullable: Allow the request if it matches any of these CEL boolean expressions evaluated against the request context (consumer, principal, HTTP attributes, consumer groups, etc.). Exactly one of `allow`, `deny`, `allow_when`, or `deny_when` must be specified.
      - `deny_when` string[], nullable: Deny the request if it matches any of these CEL boolean expressions evaluated against the request context (consumer, principal, HTTP attributes, consumer groups, etc.). Exactly one of `allow`, `deny`, `allow_when`, or `deny_when` must be specified.
    - `identity_providers` AIGatewayIdentityProviderReference[]: List of identity providers for granting access to the agent. At most 1 identity provider of each identity provider type can be referenced. Deprecated: use `auth_strategies` instead. The two are mutually exclusive.
    - `auth_strategies` AIGatewayAuthStrategyReference[]: List of auth strategies for granting access to the agent. At most 1 auth strategy of each auth strategy type can be referenced.
  - `config` object, required: Configuration for the agent. The structure varies depending on the agent type.
    - `url` string, uri, nullable: Helper field to set protocol, host, port and path of the upstream A2A Agent using a URL. This is the same as a Kong Gateway Service URL: ${scheme}://${host}:${port}/${path}
    - `upstream` AIGatewayUpstreamConfig: Configuration applied when proxying to the upstream service, including authentication.
      - `auth` AIGatewayUpstreamAuthAWS: AWS IAM (SigV4) authentication for the upstream service.
        - `type` 'aws', required
        - `access_key_id` string: The access key id for authenticating with static IAM User credentials. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `secret_access_key` string: The secret access key for authenticating with static IAM User credentials. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `session_token` string: The session token for authenticating with temporary IAM credentials. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `region` string: The AWS region of the upstream service. Overrides the region inferred from the environment.
        - `assume_role_arn` string: The ARN of the IAM role to assume for generating authentication tokens. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `role_session_name` string: The session name for the temporary credentials when assuming the IAM role. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `sts_endpoint_url` string: The STS endpoint URL to use for generating authentication tokens. If not specified, the default AWS STS endpoint will be used.
    - `route` AIGatewayRouteConfig: Configuration for an AI Gateway route.
      - `headers` object: One or more lists of values indexed by header name that will cause this route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression.
      - `hosts` string[]: A list of domain names that match this route. Note that the hosts value is case sensitive.
      - `https_redirect_status_code` integer: The status code Kong responds with when all properties of a route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the route is configured to only accept the `https` protocol.
      - `methods` string[]: A list of HTTP methods that match this route.
      - `paths` string[]: A list of paths that match this route.
      - `preserve_host` boolean: When matching a route via one of the `hosts` domain names, use the request `Host` header in the upstream request headers. If set to `false`, the upstream `Host` header will be that of the service's `host`.
      - `protocols` string[]: An array of the protocols this route should allow. See the [route Object](#route-object) section for a list of accepted protocols. When set to only `https`, HTTP requests are answered with an upgrade error. When set to only `http`, HTTPS requests are answered with an error.
      - `regex_priority` integer: A number used to choose which route resolves a given request when several routes match it using regexes simultaneously. When two routes match the path and have the same `regex_priority`, the older one (lowest `created_at`) is used. Note that the priority for non-regex routes is different (longer non-regex routes are matched before shorter ones).
      - `request_buffering` boolean: Whether to enable request body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that receive data with chunked transfer encoding.
      - `response_buffering` boolean: Whether to enable response body buffering or not. With HTTP 1.1, it may make sense to turn this off on services that send data with chunked transfer encoding.
      - `strip_path` boolean: When matching a route via one of the `paths`, strip the matching prefix from the upstream request URL.
      - `tags` string[]: An optional set of strings associated with the route for grouping and filtering.
    - `proxy` AIGatewayProxyConfig: HTTP/HTTPS proxy configuration for outbound requests to the upstream AI provider.
      - `http_proxy` object, nullable: HTTP proxy server to route plaintext outbound requests through.
        - `host` string, nullable: A string representing a host name, such as example.com.
        - `port` integer, nullable: An integer representing a port number between 0 and 65535, inclusive.
      - `https_proxy` object, nullable: HTTPS proxy server to route TLS outbound requests through.
        - `host` string, nullable: A string representing a host name, such as example.com.
        - `port` integer, nullable: An integer representing a port number between 0 and 65535, inclusive.
      - `proxy_scheme` 'http': The proxy scheme to use when connecting to the proxy server.
      - `auth` object, nullable: Credentials used to authenticate to the proxy server.
        - `username` string, nullable: The username to use for proxy authentication. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
        - `password` string, nullable: The password to use for proxy authentication. This field is [referenceable](https://developer.konghq.com/gateway/entities/vault/#how-do-i-reference-secrets-stored-in-a-vault).
      - `no_proxy` string, nullable: Comma-separated list of hosts that should not be proxied.
    - `max_request_body_size` integer: Maximum size of request body to parse. Set to 0 for unlimited.
    - `logging` object: Configuration for AI Gateway logging.
      - `payloads` boolean
      - `max_payload_size` integer: Maximum size in bytes for logged request/response payloads. Payloads exceeding this size will be truncated.
    - `certificates` AIGatewayCertificateReference[]: Client certificates used for mutual TLS (mTLS) authentication with the upstream agent endpoint, referenced by name. Each entry must be the `name` of an existing AI Certificate on the same AI Gateway. The certificates are applied to the Kong Gateway Service generated for this Agent, which proxies requests to `config.url`. The generated Service presents a single client certificate (`client_certificate`) during the TLS handshake with the upstream, so at most one certificate may be configured. If unset, no client certificate is presented to the upstream.
    - `ca_certificates` AIGatewayCACertificateReference[]: CA certificates used to verify the TLS certificate of the upstream agent endpoint, referenced by name. Each entry must be the `name` of an existing AI CA Certificate on the same AI Gateway. The CA certificates build the trust store (`ca_certificates`) of the Kong Gateway Service generated for this Agent, which proxies requests to `config.url`. If unset, the default trust store is used to verify the upstream's TLS certificate.
  - `labels` PublicLabels: Public labels store information about an entity that can be used for filtering a list of objects. Public labels are intended to store **PUBLIC** metadata. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "_".
  - `managed_by` ManagedBy: Stores information about what manages this entity, such as the tool or system responsible for its lifecycle (for example, `terraform`). Keys must be 1–63 characters long, start and end with an alphanumeric character, and may contain dashes (`-`), underscores (`_`), and dots (`.`). Values must be 1–127 characters long and must not be empty. Keys and values must not contain spaces or control characters.
  - `id` string, uuid, required: Contains a unique identifier used for this resource.
  - `created_at` string, date-time, required: An ISO-8601 timestamp representation of entity creation date.
  - `updated_at` string, date-time, required: An ISO-8601 timestamp representation of entity update date.

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `429`: Too Many Requests

## Changes

- **2026-11-20** `757a21fb79f2`: 4 breaking, 1 warning, 4 info
  - the `config/url` request property's minLength was increased from `0` to `1`
  - the response property `config/url` became nullable for the status `201`
  - the response property `config/url` became optional for the status `201`
  - the `managed_by/additionalProperties/` response property's maxLength was increased from `63` to `127` for the response status `201`
  - …5 more
- **2026-11-05** `f018071a4515`: 4 info
  - added the new optional request property `config/ca_certificates`
  - added the new optional request property `config/certificates`
  - added the optional property `config/ca_certificates` to the response with the `201` status
  - added the optional property `config/certificates` to the response with the `201` status
- **2026-10-23** `30af8b28f6ef`: 5 breaking, 2 warning, 8 info
  - the response property `config/proxy/auth` became nullable for the status `201`
  - the response property `config/proxy/http_proxy` became nullable for the status `201`
  - the response property `config/proxy/https_proxy` became nullable for the status `201`
  - the response property `config/proxy/no_proxy` became nullable for the status `201`
  - …11 more
- **2026-10-09** `1095df1ce62f`: 1 warning
  - the `config/logging/max_payload_size` request property's exclusiveMinimum was set to `true`
- …earlier changes not shown

[Operation history](https://skmtc.dev/kong/apis/konnect-api/changes/v1/ai-gateways/:gatewayId/agents/post.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api/revisions/5da43f6209ea?raw)
