openapi: 3.0.0
info:
  version: "2026-04-01"
  title: Glean Platform API
  x-source-commit-sha: 36490380aba39f767c75800da51cc926b7c58f58
  x-open-api-commit-sha: 174a041ef5d07c9ff5b6c8244de3262dbdad2b24
servers:
  - url: https://{instance}-be.glean.com
    variables:
      instance:
        default: instance-name
        description: The instance name (typically the email domain without the TLD) that determines the deployment backend.
security:
  - APIToken: []
paths:
  /api/agents/search:
    post:
      tags:
        - Agents
      summary: Search agents
      description: |
        Search agents available to the authenticated user by agent name.
      operationId: platform-agents-search
      x-visibility: Public
      x-glean-experimental:
        id: 4abc1e17-8e06-490b-99a7-e8f97592405a
        introduced: "2026-05-12"
      x-codegen-request-body-name: payload
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PlatformAgentsSearchRequest"
      responses:
        "200":
          description: Successful response.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlatformAgentsSearchResponse"
        "400":
          $ref: "#/components/responses/PlatformBadRequest"
        "401":
          $ref: "#/components/responses/PlatformUnauthorized"
        "403":
          $ref: "#/components/responses/PlatformForbidden"
        "404":
          $ref: "#/components/responses/PlatformNotFound"
        "408":
          $ref: "#/components/responses/PlatformRequestTimeout"
        "413":
          $ref: "#/components/responses/PlatformRequestTooLarge"
        "429":
          $ref: "#/components/responses/PlatformTooManyRequests"
        "500":
          $ref: "#/components/responses/PlatformInternalServerError"
        "503":
          $ref: "#/components/responses/PlatformServiceUnavailable"
      x-speakeasy-group: agents
      x-speakeasy-name-override: search
      x-codeSamples:
        - lang: python
          label: Python (API Client)
          source: |-
            from glean.api_client import Glean
            import os


            with Glean(
                api_token=os.getenv("GLEAN_API_TOKEN", ""),
                server_url="https://mycompany-be.glean.com",
                include_experimental=True,
            ) as glean:

                res = glean.agents.search(name="HR Policy Agent")

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (API Client)
          source: |-
            import { Glean } from "@gleanwork/api-client";

            const glean = new Glean({
              apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
              serverURL: "https://mycompany-be.glean.com",
              includeExperimental: true,
            });

            async function run() {
              const result = await glean.agents.search({
                name: "HR Policy Agent",
              });

              console.log(result);
            }

            run();
        - lang: go
          label: Go (API Client)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tapiclientgo \"github.com/gleanwork/api-client-go\"\n\t\"github.com/gleanwork/api-client-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := apiclientgo.New(\n        apiclientgo.WithSecurity(os.Getenv(\"GLEAN_API_TOKEN\")),\n        apiclientgo.WithServerURL(\"https://mycompany-be.glean.com\"),\n        apiclientgo.WithIncludeExperimental(true),\n    )\n\n    res, err := s.Agents.Search(ctx, components.PlatformAgentsSearchRequest{\n        Name: apiclientgo.Pointer(\"HR Policy Agent\"),\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.PlatformAgentsSearchResponse != nil {\n        // handle response\n    }\n}"
        - lang: java
          label: Java (API Client)
          source: |-
            package hello.world;

            import com.glean.api_client.glean_api_client.Glean;
            import com.glean.api_client.glean_api_client.hooks.GleanBuilder;
            import com.glean.api_client.glean_api_client.models.components.PlatformAgentsSearchRequest;
            import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
            import com.glean.api_client.glean_api_client.models.operations.PlatformAgentsSearchResponse;
            import java.lang.Exception;

            public class Application {

                public static void main(String[] args) throws PlatformProblemDetailException, Exception {

                    Glean sdk = GleanBuilder.create()
                            .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
                            .includeExperimental(true)
                        .build();

                    PlatformAgentsSearchRequest req = PlatformAgentsSearchRequest.builder()
                            .name("HR Policy Agent")
                            .build();

                    PlatformAgentsSearchResponse res = sdk.agents().search()
                            .request(req)
                            .call();

                    if (res.platformAgentsSearchResponse().isPresent()) {
                        System.out.println(res.platformAgentsSearchResponse().get());
                    }
                }
            }
  /api/agents/{agent_id}:
    get:
      tags:
        - Agents
      summary: Get agent
      description: |
        Retrieve details for an agent available to the authenticated user.
      operationId: platform-agents-get
      x-visibility: Public
      x-glean-experimental:
        id: 009b3e94-694b-4deb-b80a-c67011173715
        introduced: "2026-05-12"
      parameters:
        - in: path
          name: agent_id
          description: ID of the agent to retrieve.
          required: true
          schema:
            type: string
            minLength: 1
      responses:
        "200":
          description: Successful response.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlatformAgentGetResponse"
        "400":
          $ref: "#/components/responses/PlatformBadRequest"
        "401":
          $ref: "#/components/responses/PlatformUnauthorized"
        "403":
          $ref: "#/components/responses/PlatformForbidden"
        "404":
          $ref: "#/components/responses/PlatformNotFound"
        "408":
          $ref: "#/components/responses/PlatformRequestTimeout"
        "429":
          $ref: "#/components/responses/PlatformTooManyRequests"
        "500":
          $ref: "#/components/responses/PlatformInternalServerError"
        "503":
          $ref: "#/components/responses/PlatformServiceUnavailable"
      x-speakeasy-group: agents
      x-speakeasy-name-override: get
      x-codeSamples:
        - lang: python
          label: Python (API Client)
          source: |-
            from glean.api_client import Glean
            import os


            with Glean(
                api_token=os.getenv("GLEAN_API_TOKEN", ""),
                server_url="https://mycompany-be.glean.com",
                include_experimental=True,
            ) as glean:

                res = glean.agents.get(agent_id="<id>")

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (API Client)
          source: |-
            import { Glean } from "@gleanwork/api-client";

            const glean = new Glean({
              apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
              serverURL: "https://mycompany-be.glean.com",
              includeExperimental: true,
            });

            async function run() {
              const result = await glean.agents.get("<id>");

              console.log(result);
            }

            run();
        - lang: go
          label: Go (API Client)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tapiclientgo \"github.com/gleanwork/api-client-go\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := apiclientgo.New(\n        apiclientgo.WithSecurity(os.Getenv(\"GLEAN_API_TOKEN\")),\n        apiclientgo.WithServerURL(\"https://mycompany-be.glean.com\"),\n        apiclientgo.WithIncludeExperimental(true),\n    )\n\n    res, err := s.Agents.Get(ctx, \"<id>\")\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.PlatformAgentGetResponse != nil {\n        // handle response\n    }\n}"
        - lang: java
          label: Java (API Client)
          source: |-
            package hello.world;

            import com.glean.api_client.glean_api_client.Glean;
            import com.glean.api_client.glean_api_client.hooks.GleanBuilder;
            import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
            import com.glean.api_client.glean_api_client.models.operations.PlatformAgentsGetResponse;
            import java.lang.Exception;

            public class Application {

                public static void main(String[] args) throws PlatformProblemDetailException, Exception {

                    Glean sdk = GleanBuilder.create()
                            .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
                            .includeExperimental(true)
                        .build();

                    PlatformAgentsGetResponse res = sdk.agents().get()
                            .agentId("<id>")
                            .call();

                    if (res.platformAgentGetResponse().isPresent()) {
                        System.out.println(res.platformAgentGetResponse().get());
                    }
                }
            }
  /api/agents/{agent_id}/schemas:
    get:
      tags:
        - Agents
      summary: Get agent schemas
      description: |
        Retrieve an agent's input and output JSON schemas.
      operationId: platform-agents-get-schemas
      x-visibility: Public
      x-glean-experimental:
        id: b40b4dd3-3839-48e6-9e45-7e63e8148b49
        introduced: "2026-05-12"
      parameters:
        - in: path
          name: agent_id
          description: ID of the agent whose schemas should be retrieved.
          required: true
          schema:
            type: string
            minLength: 1
        - in: query
          name: include_tools
          description: Whether to include tool metadata in the response.
          required: false
          schema:
            type: boolean
            default: false
      responses:
        "200":
          description: Successful response.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlatformAgentSchemasResponse"
        "400":
          $ref: "#/components/responses/PlatformBadRequest"
        "401":
          $ref: "#/components/responses/PlatformUnauthorized"
        "403":
          $ref: "#/components/responses/PlatformForbidden"
        "404":
          $ref: "#/components/responses/PlatformNotFound"
        "408":
          $ref: "#/components/responses/PlatformRequestTimeout"
        "429":
          $ref: "#/components/responses/PlatformTooManyRequests"
        "500":
          $ref: "#/components/responses/PlatformInternalServerError"
        "503":
          $ref: "#/components/responses/PlatformServiceUnavailable"
      x-speakeasy-group: agents
      x-speakeasy-name-override: getSchemas
      x-codeSamples:
        - lang: python
          label: Python (API Client)
          source: |-
            from glean.api_client import Glean
            import os


            with Glean(
                api_token=os.getenv("GLEAN_API_TOKEN", ""),
                server_url="https://mycompany-be.glean.com",
                include_experimental=True,
            ) as glean:

                res = glean.agents.get_schemas(agent_id="<id>", include_tools=False)

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (API Client)
          source: |-
            import { Glean } from "@gleanwork/api-client";

            const glean = new Glean({
              apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
              serverURL: "https://mycompany-be.glean.com",
              includeExperimental: true,
            });

            async function run() {
              const result = await glean.agents.getSchemas("<id>");

              console.log(result);
            }

            run();
        - lang: go
          label: Go (API Client)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tapiclientgo \"github.com/gleanwork/api-client-go\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := apiclientgo.New(\n        apiclientgo.WithSecurity(os.Getenv(\"GLEAN_API_TOKEN\")),\n        apiclientgo.WithServerURL(\"https://mycompany-be.glean.com\"),\n        apiclientgo.WithIncludeExperimental(true),\n    )\n\n    res, err := s.Agents.GetSchemas(ctx, \"<id>\", apiclientgo.Pointer(false))\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.PlatformAgentSchemasResponse != nil {\n        // handle response\n    }\n}"
        - lang: java
          label: Java (API Client)
          source: |-
            package hello.world;

            import com.glean.api_client.glean_api_client.Glean;
            import com.glean.api_client.glean_api_client.hooks.GleanBuilder;
            import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
            import com.glean.api_client.glean_api_client.models.operations.PlatformAgentsGetSchemasResponse;
            import java.lang.Exception;

            public class Application {

                public static void main(String[] args) throws PlatformProblemDetailException, Exception {

                    Glean sdk = GleanBuilder.create()
                            .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
                            .includeExperimental(true)
                        .build();

                    PlatformAgentsGetSchemasResponse res = sdk.agents().getSchemas()
                            .agentId("<id>")
                            .includeTools(false)
                            .call();

                    if (res.platformAgentSchemasResponse().isPresent()) {
                        System.out.println(res.platformAgentSchemasResponse().get());
                    }
                }
            }
  /api/agents/{agent_id}/runs:
    post:
      tags:
        - Agents
      summary: Create agent run
      description: |
        Execute an agent run. Set `stream` to true to receive server-sent events; otherwise the response contains the final agent messages.
      operationId: platform-agents-create-run
      x-visibility: Public
      x-glean-experimental:
        id: 26bba669-2e92-4e5d-9798-6a532fae4e9f
        introduced: "2026-05-12"
      x-codegen-request-body-name: payload
      parameters:
        - in: path
          name: agent_id
          description: ID of the agent to run.
          required: true
          schema:
            type: string
            minLength: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PlatformAgentRunCreateRequest"
      responses:
        "200":
          description: Successful response.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlatformAgentRunWaitResponse"
            text/event-stream:
              schema:
                type: string
                description: Server-sent events emitted by the running agent.
                example: |
                  id: 1
                  event: message
                  data: {"messages":[{"role":"GLEAN_AI","content":[{"text":"Hello","type":"text"}]}]}

                  id: 2
                  event: message
                  data: {"messages":[{"role":"GLEAN_AI","content":[{"text":", I can help with HR policy questions.","type":"text"}]}]}
        "400":
          $ref: "#/components/responses/PlatformBadRequest"
        "401":
          $ref: "#/components/responses/PlatformUnauthorized"
        "403":
          $ref: "#/components/responses/PlatformForbidden"
        "404":
          $ref: "#/components/responses/PlatformNotFound"
        "408":
          $ref: "#/components/responses/PlatformRequestTimeout"
        "409":
          $ref: "#/components/responses/PlatformConflict"
        "413":
          $ref: "#/components/responses/PlatformRequestTooLarge"
        "429":
          $ref: "#/components/responses/PlatformTooManyRequests"
        "500":
          $ref: "#/components/responses/PlatformInternalServerError"
        "503":
          $ref: "#/components/responses/PlatformServiceUnavailable"
      x-speakeasy-group: agents
      x-speakeasy-name-override: createRun
      x-codeSamples:
        - lang: python
          label: Python (API Client)
          source: |-
            from glean.api_client import Glean, models
            import os


            with Glean(
                api_token=os.getenv("GLEAN_API_TOKEN", ""),
                server_url="https://mycompany-be.glean.com",
                include_experimental=True,
            ) as glean:

                res = glean.agents.create_run(agent_id="<id>", messages=[
                    {
                        "role": models.PlatformMessageRole.USER,
                        "content": [],
                    },
                ], stream=False)

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (API Client)
          source: |-
            import { Glean } from "@gleanwork/api-client";

            const glean = new Glean({
              apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
              serverURL: "https://mycompany-be.glean.com",
              includeExperimental: true,
            });

            async function run() {
              const result = await glean.agents.createRun({
                messages: [
                  {
                    role: "USER",
                    content: [],
                  },
                ],
              }, "<id>");

              console.log(result);
            }

            run();
        - lang: go
          label: Go (API Client)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tapiclientgo \"github.com/gleanwork/api-client-go\"\n\t\"github.com/gleanwork/api-client-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := apiclientgo.New(\n        apiclientgo.WithSecurity(os.Getenv(\"GLEAN_API_TOKEN\")),\n        apiclientgo.WithServerURL(\"https://mycompany-be.glean.com\"),\n        apiclientgo.WithIncludeExperimental(true),\n    )\n\n    res, err := s.Agents.CreateRun(ctx, \"<id>\", components.PlatformAgentRunCreateRequest{\n        Messages: []components.PlatformMessage{\n            components.PlatformMessage{\n                Role: components.PlatformMessageRoleUser,\n                Content: []components.PlatformMessageTextBlock{},\n            },\n        },\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.PlatformAgentRunWaitResponse != nil {\n        // handle response\n    }\n}"
        - lang: java
          label: Java (API Client)
          source: |-
            package hello.world;

            import com.glean.api_client.glean_api_client.Glean;
            import com.glean.api_client.glean_api_client.hooks.GleanBuilder;
            import com.glean.api_client.glean_api_client.models.components.*;
            import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
            import com.glean.api_client.glean_api_client.models.operations.PlatformAgentsCreateRunResponse;
            import java.lang.Exception;
            import java.util.List;

            public class Application {

                public static void main(String[] args) throws PlatformProblemDetailException, Exception {

                    Glean sdk = GleanBuilder.create()
                            .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
                            .includeExperimental(true)
                        .build();

                    PlatformAgentsCreateRunResponse res = sdk.agents().createRun()
                            .agentId("<id>")
                            .platformAgentRunCreateRequest(PlatformAgentRunCreateRequest.builder()
                                .messages(List.of(
                                    PlatformMessage.builder()
                                        .role(PlatformMessageRole.USER)
                                        .content(List.of())
                                        .build()))
                                .build())
                            .call();

                    if (res.platformAgentRunWaitResponse().isPresent()) {
                        System.out.println(res.platformAgentRunWaitResponse().get());
                    }
                }
            }
  /api/search:
    post:
      tags:
        - Search
      summary: Search
      description: |
        Execute a search query and retrieve ranked results. This is the data retrieval variant of the search API and returns only results and pagination state.
      operationId: platform-search
      x-visibility: Public
      x-glean-experimental:
        id: 5ab612fc-ed50-4419-bec3-e5fe83934653
        introduced: "2026-04-08"
      x-codegen-request-body-name: payload
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PlatformSearchRequest"
      responses:
        "200":
          description: Successful search.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlatformSearchResponse"
        "400":
          $ref: "#/components/responses/PlatformBadRequest"
        "401":
          $ref: "#/components/responses/PlatformUnauthorized"
        "403":
          $ref: "#/components/responses/PlatformForbidden"
        "404":
          $ref: "#/components/responses/PlatformNotFound"
        "408":
          $ref: "#/components/responses/PlatformRequestTimeout"
        "413":
          $ref: "#/components/responses/PlatformRequestTooLarge"
        "429":
          $ref: "#/components/responses/PlatformTooManyRequests"
        "500":
          $ref: "#/components/responses/PlatformInternalServerError"
        "503":
          $ref: "#/components/responses/PlatformServiceUnavailable"
      x-speakeasy-group: search
      x-speakeasy-name-override: query
      x-codeSamples:
        - lang: python
          label: Python (API Client)
          source: |-
            from glean.api_client import Glean
            import os


            with Glean(
                api_token=os.getenv("GLEAN_API_TOKEN", ""),
                server_url="https://mycompany-be.glean.com",
                include_experimental=True,
            ) as glean:

                res = glean.search.query(query="quarterly planning 2026", page_size=10, datasources=[
                    "confluence",
                    "google_drive",
                ], datasource_instances=[
                    "slack_acme",
                    "slack_eu",
                ], filters=[
                    {
                        "field": "type",
                        "values": [
                            "spreadsheet",
                            "presentation",
                        ],
                    },
                ])

                # Handle response
                print(res)
        - lang: typescript
          label: Typescript (API Client)
          source: |-
            import { Glean } from "@gleanwork/api-client";

            const glean = new Glean({
              apiToken: process.env["GLEAN_API_TOKEN"] ?? "",
              serverURL: "https://mycompany-be.glean.com",
              includeExperimental: true,
            });

            async function run() {
              const result = await glean.search.query({
                query: "quarterly planning 2026",
                datasources: [
                  "confluence",
                  "google_drive",
                ],
                datasource_instances: [
                  "slack_acme",
                  "slack_eu",
                ],
                filters: [
                  {
                    field: "type",
                    values: [
                      "spreadsheet",
                      "presentation",
                    ],
                  },
                ],
              });

              console.log(result);
            }

            run();
        - lang: go
          label: Go (API Client)
          source: "package main\n\nimport(\n\t\"context\"\n\t\"os\"\n\tapiclientgo \"github.com/gleanwork/api-client-go\"\n\t\"github.com/gleanwork/api-client-go/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := apiclientgo.New(\n        apiclientgo.WithSecurity(os.Getenv(\"GLEAN_API_TOKEN\")),\n        apiclientgo.WithServerURL(\"https://mycompany-be.glean.com\"),\n        apiclientgo.WithIncludeExperimental(true),\n    )\n\n    res, err := s.Search.Query(ctx, components.PlatformSearchRequest{\n        Query: \"quarterly planning 2026\",\n        Datasources: []string{\n            \"confluence\",\n            \"google_drive\",\n        },\n        DatasourceInstances: []string{\n            \"slack_acme\",\n            \"slack_eu\",\n        },\n        Filters: []components.PlatformFilter{\n            components.PlatformFilter{\n                Field: \"type\",\n                Values: []string{\n                    \"spreadsheet\",\n                    \"presentation\",\n                },\n            },\n        },\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.PlatformSearchResponse != nil {\n        // handle response\n    }\n}"
        - lang: java
          label: Java (API Client)
          source: |-
            package hello.world;

            import com.glean.api_client.glean_api_client.Glean;
            import com.glean.api_client.glean_api_client.hooks.GleanBuilder;
            import com.glean.api_client.glean_api_client.models.components.PlatformFilter;
            import com.glean.api_client.glean_api_client.models.components.PlatformSearchRequest;
            import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
            import com.glean.api_client.glean_api_client.models.operations.PlatformSearchResponse;
            import java.lang.Exception;
            import java.util.List;

            public class Application {

                public static void main(String[] args) throws PlatformProblemDetailException, Exception {

                    Glean sdk = GleanBuilder.create()
                            .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
                            .includeExperimental(true)
                        .build();

                    PlatformSearchRequest req = PlatformSearchRequest.builder()
                            .query("quarterly planning 2026")
                            .datasources(List.of(
                                "confluence",
                                "google_drive"))
                            .datasourceInstances(List.of(
                                "slack_acme",
                                "slack_eu"))
                            .filters(List.of(
                                PlatformFilter.builder()
                                    .field("type")
                                    .values(List.of(
                                        "spreadsheet",
                                        "presentation"))
                                    .build()))
                            .build();

                    PlatformSearchResponse res = sdk.search().query()
                            .request(req)
                            .call();

                    if (res.platformSearchResponse().isPresent()) {
                        System.out.println(res.platformSearchResponse().get());
                    }
                }
            }
components:
  securitySchemes:
    APIToken:
      type: http
      scheme: bearer
      description: |
        Glean API token. Obtain via Admin Console -> Platform -> API Tokens, or via OAuth 2.0 client credentials flow.
  schemas:
    PlatformAgentsSearchRequest:
      type: object
      additionalProperties: false
      properties:
        name:
          type: string
          description: Case-insensitive substring to match against agent names. If omitted or empty, no name filter is applied.
          example: HR Policy Agent
    PlatformAgentCapabilities:
      type: object
      additionalProperties: true
      properties:
        ap.io.messages:
          type: boolean
          description: Whether the agent supports messages as input.
        ap.io.streaming:
          type: boolean
          description: Whether the agent supports streaming output.
    PlatformAgent:
      type: object
      required:
        - agent_id
        - name
        - capabilities
      properties:
        agent_id:
          type: string
          description: ID of the agent.
          example: mho4lwzylcozgoc2
        name:
          type: string
          description: Name of the agent.
          example: HR Policy Agent
        description:
          type: string
          description: Description of the agent.
        metadata:
          type: object
          description: Agent metadata.
          additionalProperties: true
        capabilities:
          $ref: "#/components/schemas/PlatformAgentCapabilities"
    PlatformAgentsSearchResponse:
      type: object
      required:
        - agents
        - request_id
      properties:
        agents:
          type: array
          description: Agents matching the search request.
          items:
            $ref: "#/components/schemas/PlatformAgent"
        request_id:
          type: string
          description: Platform-generated request ID for support correlation.
    PlatformProblemDetailCode:
      type: string
      description: Stable machine-readable error code.
      enum:
        - invalid_request
        - missing_required_field
        - invalid_parameter
        - invalid_cursor
        - expired_cursor
        - invalid_filter
        - invalid_datasource
        - authentication_required
        - token_expired
        - insufficient_permissions
        - resource_not_found
        - method_not_allowed
        - request_timeout
        - request_too_large
        - conflict
        - gone
        - unprocessable_query
        - rate_limit_exceeded
        - internal_error
        - service_unavailable
      x-glean-problem-detail-codes:
        invalid_request:
          status: 400
          title: Invalid Request
        missing_required_field:
          status: 400
          title: Missing Required Field
        invalid_parameter:
          status: 400
          title: Invalid Parameter
        invalid_cursor:
          status: 400
          title: Invalid Pagination Cursor
        expired_cursor:
          status: 400
          title: Expired Pagination Cursor
        invalid_filter:
          status: 400
          title: Invalid Filter
        invalid_datasource:
          status: 400
          title: Invalid Datasource
        authentication_required:
          status: 401
          title: Authentication Required
        token_expired:
          status: 401
          title: Token Expired
        insufficient_permissions:
          status: 403
          title: Insufficient Permissions
        resource_not_found:
          status: 404
          title: Resource Not Found
        method_not_allowed:
          status: 405
          title: Method Not Allowed
        request_timeout:
          status: 408
          title: Request Timeout
        request_too_large:
          status: 413
          title: Request Too Large
        conflict:
          status: 409
          title: Conflict
        gone:
          status: 410
          title: Gone
        unprocessable_query:
          status: 422
          title: Unprocessable Query
        rate_limit_exceeded:
          status: 429
          title: Rate Limit Exceeded
        internal_error:
          status: 500
          title: Internal Error
        service_unavailable:
          status: 503
          title: Service Unavailable
      example: invalid_cursor
    PlatformProblemDetailError:
      type: object
      required:
        - pointer
        - detail
      description: Field-level validation problem for a single offending field.
      properties:
        pointer:
          type: string
          description: RFC 6901 JSON Pointer to the offending field.
          example: /messages/0/role
        detail:
          type: string
          description: Human-readable explanation for this field.
          example: "Must be one of: USER, GLEAN_AI."
        code:
          $ref: "#/components/schemas/PlatformProblemDetailCode"
    PlatformProblemDetail:
      type: object
      required:
        - type
        - title
        - status
        - detail
        - code
        - request_id
      description: |
        Error response following RFC 9457, extended with `code` and `documentation_url` for machine-readable classification and self-service remediation.
      properties:
        type:
          type: string
          format: uri
          description: URI identifying the error type.
          example: https://developers.glean.com/errors/invalid-cursor
        title:
          type: string
          description: Short, human-readable summary of the error.
          example: Invalid Pagination Cursor
        status:
          type: integer
          description: HTTP status code mirrored from the response.
          example: 400
        detail:
          type: string
          description: Human-readable explanation specific to this occurrence.
          example: |
            The provided cursor has expired. Start a new search to get a fresh cursor.
        code:
          $ref: "#/components/schemas/PlatformProblemDetailCode"
        documentation_url:
          type: string
          format: uri
          description: Direct URL to documentation for this error code.
          example: https://developers.glean.com/errors/invalid-cursor
        request_id:
          type: string
          description: Platform-generated request ID for support correlation.
          example: req_7f8a9b0c1d2e
        errors:
          type: array
          description: Field-level validation problems, one entry per offending field.
          items:
            $ref: "#/components/schemas/PlatformProblemDetailError"
    PlatformAgentGetResponse:
      type: object
      required:
        - agent
        - request_id
      properties:
        agent:
          $ref: "#/components/schemas/PlatformAgent"
        request_id:
          type: string
          description: Platform-generated request ID for support correlation.
    PlatformActionSummary:
      type: object
      required:
        - tool_id
        - display_name
      properties:
        tool_id:
          type: string
          description: Unique identifier of the action.
        display_name:
          type: string
          description: Display name of the action.
        type:
          type: string
          description: Tool type.
        auth_type:
          type: string
          description: Authentication type required by the action.
        write_action_type:
          type: string
          description: Write-action execution type.
        is_setup_finished:
          type: boolean
          description: Whether this action has been fully configured.
        data_source:
          type: string
          description: Kind of knowledge the action accesses or modifies.
    PlatformAgentSchemasResponse:
      type: object
      required:
        - agent_id
        - input_schema
        - output_schema
        - request_id
      properties:
        agent_id:
          type: string
          description: ID of the agent.
        name:
          type: string
          description: Name of the agent.
        input_schema:
          type: object
          description: Agent input schema in JSON Schema format.
          additionalProperties: true
        output_schema:
          type: object
          description: Agent output schema in JSON Schema format.
          additionalProperties: true
        tools:
          type: array
          description: Tools that the agent can invoke, when requested.
          items:
            $ref: "#/components/schemas/PlatformActionSummary"
        request_id:
          type: string
          description: Platform-generated request ID for support correlation.
    PlatformMessageRole:
      type: string
      description: Role of the message author.
      example: USER
      enum:
        - USER
        - GLEAN_AI
    PlatformContentType:
      type: string
      enum:
        - text
    PlatformMessageTextBlock:
      type: object
      required:
        - text
        - type
      properties:
        text:
          type: string
          description: Text content.
        type:
          $ref: "#/components/schemas/PlatformContentType"
    PlatformMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          $ref: "#/components/schemas/PlatformMessageRole"
        content:
          type: array
          minItems: 1
          description: Content blocks in the message.
          items:
            $ref: "#/components/schemas/PlatformMessageTextBlock"
    PlatformAgentRunCreateRequest:
      type: object
      additionalProperties: false
      description: |
        Request to run an agent. A request MUST supply either `messages` (a non-empty conversation) or `input` (for input-form triggered agents).
      properties:
        input:
          type: object
          description: Input fields for an input-form triggered agent.
          additionalProperties: true
        messages:
          type: array
          minItems: 1
          description: |
            Messages to pass to the agent. When provided, the array MUST contain at least one message and each message MUST specify a valid `role` and non-empty `content`.
          items:
            $ref: "#/components/schemas/PlatformMessage"
        metadata:
          type: object
          description: Metadata to pass to the agent.
          additionalProperties: true
        stream:
          type: boolean
          description: Whether to stream the run response as server-sent events.
          default: false
    PlatformAgentRunCreate:
      type: object
      required:
        - agent_id
      properties:
        agent_id:
          type: string
          description: ID of the agent being run.
        input:
          type: object
          description: Input fields for an input-form triggered agent.
          additionalProperties: true
        messages:
          type: array
          description: Messages passed to the agent.
          items:
            $ref: "#/components/schemas/PlatformMessage"
        metadata:
          type: object
          description: Metadata passed to the agent.
          additionalProperties: true
    PlatformAgentExecutionStatus:
      type: string
      description: Status of the agent run.
      enum:
        - error
        - success
    PlatformAgentRun:
      allOf:
        - $ref: "#/components/schemas/PlatformAgentRunCreate"
        - type: object
          required:
            - status
          properties:
            status:
              $ref: "#/components/schemas/PlatformAgentExecutionStatus"
    PlatformAgentRunWaitResponse:
      type: object
      required:
        - request_id
      properties:
        run:
          $ref: "#/components/schemas/PlatformAgentRun"
        messages:
          type: array
          description: Messages returned by the completed run.
          items:
            $ref: "#/components/schemas/PlatformMessage"
        request_id:
          type: string
          description: Platform-generated request ID for support correlation.
    PlatformFilterOperator:
      type: string
      description: Supported filter operator.
      enum:
        - EQUALS
        - NOT_EQUALS
        - GT
        - GTE
        - LT
        - LTE
    PlatformFilter:
      type: object
      required:
        - field
        - values
      description: |
        A single filter criterion. For `EQUALS`, multiple values within a filter are OR'd. For `NOT_EQUALS`, multiple values exclude all listed values. Filters are AND'd with each other and with any inline query operators.
      properties:
        field:
          type: string
          description: |
            The field to filter on. Accepts built-in filter field names such as `type`, `owner`, `from`, `author`, `channel`, `status`, `assignee`, `reporter`, `component`, `mentions`, and `collection`, plus custom datasource property names.
          example: type
        values:
          type: array
          minItems: 1
          items:
            type: string
          description: One or more values to match.
          example:
            - spreadsheet
            - presentation
        operator:
          allOf:
            - $ref: "#/components/schemas/PlatformFilterOperator"
          description: |
            Comparison operator to apply to this filter. Defaults to `EQUALS`. `GT`, `GTE`, `LT`, and `LTE` range operators require exactly one value; express bounded ranges with multiple filters on the same field.
    PlatformTimeRange:
      type: object
      description: Filter results to those last updated within this range.
      properties:
        start:
          type: string
          format: date-time
          description: Inclusive lower bound in ISO 8601 format.
        end:
          type: string
          format: date-time
          description: Exclusive upper bound in ISO 8601 format.
    PlatformSearchRequest:
      type: object
      additionalProperties: false
      required:
        - query
      properties:
        query:
          type: string
          description: |
            The search query string. Supports inline operators such as `from:jane type:document app:confluence`. Inline operators are AND'd with structured `filters`.
          example: quarterly planning 2026
        page_size:
          type: integer
          minimum: 1
          maximum: 100
          default: 10
          description: Number of results to return per page.
        cursor:
          type: string
          nullable: true
          description: |
            Opaque pagination token from a previous response's `next_cursor` field. Omit on the first request.
        datasources:
          type: array
          items:
            type: string
          description: |
            Restrict results to specific datasources. Requests must not specify both `datasources` and `datasource_instances`.
          example:
            - confluence
            - google_drive
        datasource_instances:
          type: array
          items:
            type: string
          description: |
            Restrict results to specific datasource instances. Values are datasource instance identifiers returned by `GET /api/search/filters`. Requests must not specify both `datasources` and `datasource_instances`.
          example:
            - slack_acme
            - slack_eu
        filters:
          type: array
          items:
            $ref: "#/components/schemas/PlatformFilter"
          description: |
            Structured filters applied to search results. Equality operators OR multiple values within a filter. Multiple filters are AND'd together, including range filters on the same field. Filters are AND'd with any inline operators in `query`. Note that conflicting constraints on the same field (e.g., `type:document` in the query and `type: spreadsheet` in a filter) produce an empty result set.
        time_range:
          $ref: "#/components/schemas/PlatformTimeRange"
    PlatformPersonReference:
      type: object
      description: A lightweight reference to a person, used where a payload merely points at someone.
      required:
        - name
      properties:
        id:
          type: string
          description: Opaque Glean person ID.
        name:
          type: string
          description: Display name.
    PlatformResult:
      type: object
      required:
        - url
        - title
        - datasource
      properties:
        url:
          type: string
          format: uri
          description: Canonical URL of the result.
          example: https://company.atlassian.net/wiki/spaces/ENG/pages/12345
        title:
          type: string
          description: Result title.
          example: Q2 2026 Platform Roadmap
        snippets:
          type: array
          items:
            type: string
          description: Query-relevant plain-text excerpts from the result body.
          example:
            - The platform team will focus on API stability and...
        datasource:
          type: string
          description: The datasource this result originates from.
          example: confluence
        datasource_instance:
          type: string
          nullable: true
          description: The datasource instance this result originates from, if known.
          example: confluence_acme
        document_type:
          type: string
          nullable: true
          description: The document type within the datasource.
          example: page
        creator:
          $ref: "#/components/schemas/PlatformPersonReference"
        owner:
          $ref: "#/components/schemas/PlatformPersonReference"
        updated_at:
          type: string
          format: date-time
          nullable: true
          description: When the result was last modified.
        created_at:
          type: string
          format: date-time
          nullable: true
          description: When the result was created.
    PlatformSearchResponse:
      type: object
      required:
        - results
        - has_more
        - next_cursor
        - request_id
      properties:
        results:
          type: array
          items:
            $ref: "#/components/schemas/PlatformResult"
          description: Ordered list of search results.
        has_more:
          type: boolean
          description: Indicates whether additional pages of results are available.
        next_cursor:
          type: string
          nullable: true
          description: Opaque token to pass as `cursor` in the next request.
        request_id:
          type: string
          description: Platform-generated request ID for support correlation.
  responses:
    PlatformBadRequest:
      description: Invalid request (malformed JSON, invalid parameter values, unknown fields).
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformUnauthorized:
      description: Missing or invalid authentication token.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformForbidden:
      description: Token valid but lacks permission for the requested operation.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformNotFound:
      description: Resource not found.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformRequestTimeout:
      description: Backend did not respond within the timeout window.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformRequestTooLarge:
      description: Request body exceeds the maximum allowed size.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformTooManyRequests:
      description: Rate limit exceeded. Includes Retry-After header.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformInternalServerError:
      description: Unexpected server-side failure.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformServiceUnavailable:
      description: Backend temporarily unavailable.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
    PlatformConflict:
      description: Request conflicts with current state of the resource.
      content:
        application/problem+json:
          schema:
            $ref: "#/components/schemas/PlatformProblemDetail"
