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

# Process Application



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/sgp/openapi.yml post /v4/applications/process
openapi: 3.1.0
info:
  title: EGP API V4
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
tags:
  - name: Models
    description: Model API.
paths:
  /v4/applications/process:
    post:
      tags:
        - Applications
      summary: Process Application
      operationId: POST-V4-/applications/process
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TestApplicationProcessingRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidApplicationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationProcessingErrorResponse'
          description: Internal Server Error
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from scale_gp import SGPClient

            client = SGPClient(
                api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
            )
            response = client.applications.process(
                edges=[{
                    "from_field": "from_field",
                    "from_node": "from_node",
                    "to_field": "to_field",
                    "to_node": "to_node",
                }],
                inputs={
                    "foo": {
                        "foo": "bar"
                    }
                },
                nodes=[{
                    "id": "id",
                    "application_node_schema_id": "text_input_schema",
                }],
                version="V0",
            )
            print(response)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/stainless-sdks/sgp-go\"\n\t\"github.com/stainless-sdks/sgp-go/option\"\n)\n\nfunc main() {\n\tclient := sgp.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Applications.Process(context.TODO(), sgp.ApplicationProcessParams{\n\t\tEdges: sgp.F([]sgp.ApplicationEdgeParam{{\n\t\t\tFromField: sgp.F(\"from_field\"),\n\t\t\tFromNode:  sgp.F(\"from_node\"),\n\t\t\tToField:   sgp.F(\"to_field\"),\n\t\t\tToNode:    sgp.F(\"to_node\"),\n\t\t}}),\n\t\tInputs: sgp.F(map[string]map[string]interface{}{\n\t\t\t\"foo\": {\n\t\t\t\t\"foo\": \"bar\",\n\t\t\t},\n\t\t}),\n\t\tNodes: sgp.F([]sgp.ApplicationNodeParam{{\n\t\t\tID:                      sgp.F(\"id\"),\n\t\t\tApplicationNodeSchemaID: sgp.F(sgp.ApplicationNodeApplicationNodeSchemaIDTextInputSchema),\n\t\t}}),\n\t\tVersion: sgp.F(sgp.ApplicationProcessParamsVersionV0),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n"
components:
  schemas:
    TestApplicationProcessingRequest:
      properties:
        inputs:
          additionalProperties:
            additionalProperties: true
            type: object
          type: object
          title: Inputs
          description: >-
            Input data for the application. You must provide inputs for each
            input node
        history:
          title: History
          description: History of the application
          default: []
          items:
            $ref: '#/components/schemas/ApplicationRequestResponsePair'
          type: array
        overrides:
          anyOf:
            - $ref: '#/components/schemas/AgenticApplicationOverrides'
            - additionalProperties:
                $ref: '#/components/schemas/KnowledgeBaseNodeOverride'
              type: object
          title: Overrides
          description: Optional overrides for the application
        stream:
          title: Stream
          description: >-
            Control to have streaming of the endpoint. If the last node before
            the output is a completion node, you can set this to true to get the
            output as soon as the completion node has a token
          default: false
          type: boolean
        operation_metadata:
          title: Operation Metadata
          description: >-
            Arbitrary user-defined metadata that can be attached to the process
            operations and will be registered in the interaction.
          additionalProperties: true
          type: object
        nodes:
          items:
            $ref: '#/components/schemas/ApplicationNode'
          type: array
          title: Nodes
          description: List of nodes in the application graph
        edges:
          items:
            $ref: '#/components/schemas/ApplicationEdge'
          type: array
          title: Edges
          description: List of edges in the application graph
        version:
          type: string
          const: V0
          title: Version
          description: Version of the application schema
      type: object
      required:
        - inputs
        - nodes
        - edges
        - version
      title: TestApplicationProcessingRequest
    InvalidApplicationResponse:
      properties:
        sgp_error_code:
          type: string
          const: APPLICATION_BUILDER_VALIDATION_ERROR
          title: Sgp Error Code
          default: APPLICATION_BUILDER_VALIDATION_ERROR
        errors:
          items:
            anyOf:
              - $ref: '#/components/schemas/InvalidApplicationGraphConfiguration'
              - $ref: '#/components/schemas/InvalidApplicationEdgeConfiguration'
              - $ref: '#/components/schemas/InvalidApplicationNodeConfiguration'
              - $ref: '#/components/schemas/InvalidApplicationNodeConfigurationField'
          type: array
          title: Errors
      additionalProperties: true
      type: object
      required:
        - errors
      title: InvalidApplicationResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ApplicationProcessingErrorResponse:
      properties:
        sgp_error_code:
          type: string
          const: APPLICATION_PROCESSING_ERROR
          title: Sgp Error Code
          default: APPLICATION_PROCESSING_ERROR
        error_code:
          $ref: '#/components/schemas/ApplicationProcessingErrorCode'
        message:
          type: string
          title: Message
        detail:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
          title: Detail
      additionalProperties: true
      type: object
      required:
        - error_code
        - message
      title: ApplicationProcessingErrorResponse
    ApplicationRequestResponsePair:
      properties:
        request:
          type: string
          title: Request
          description: Request inputs
        response:
          type: string
          title: Response
          description: Response outputs
        session_data:
          title: Session Data
          description: Session data corresponding to the request response pair
          default: {}
          additionalProperties: true
          type: object
      type: object
      required:
        - request
        - response
      title: ApplicationRequestResponsePair
    AgenticApplicationOverrides:
      properties:
        concurrent:
          type: boolean
          title: Concurrent
          default: false
        use_channels:
          type: boolean
          title: Use Channels
          default: false
        initial_state:
          $ref: '#/components/schemas/MachineState'
        partial_trace:
          title: Partial Trace
          items:
            $ref: '#/components/schemas/LegacySpan'
          type: array
        return_span:
          type: boolean
          title: Return Span
          default: true
      additionalProperties: false
      type: object
      title: AgenticApplicationOverrides
      description: Execution override options for agentic applications
    KnowledgeBaseNodeOverride:
      properties:
        type:
          type: string
          const: knowledge_base_schema
          title: Type
          default: knowledge_base_schema
        artifact_ids_filter:
          items:
            type: string
          type: array
          title: Artifact Ids Filter
        artifact_name_regex:
          title: Artifact Name Regex
          items:
            type: string
          type: array
      type: object
      title: KnowledgeBaseNodeOverride
    ApplicationNode:
      properties:
        id:
          type: string
          title: Id
        application_node_schema_id:
          $ref: '#/components/schemas/NodeSchemaId'
        configuration:
          additionalProperties:
            $ref: '#/components/schemas/ConfigurationFieldValue'
          type: object
          title: Configuration
      type: object
      required:
        - id
        - application_node_schema_id
      title: ApplicationNode
    ApplicationEdge:
      properties:
        from_node:
          type: string
          title: From Node
        to_node:
          type: string
          title: To Node
        from_field:
          type: string
          title: From Field
        to_field:
          type: string
          title: To Field
      type: object
      required:
        - from_node
        - to_node
        - from_field
        - to_field
      title: ApplicationEdge
    InvalidApplicationGraphConfiguration:
      properties:
        error_code:
          $ref: '#/components/schemas/InvalidApplicationErrorCode'
        message:
          type: string
          title: Message
      type: object
      required:
        - error_code
      title: InvalidApplicationGraphConfiguration
      description: Raised when application graph configuration is invalid
    InvalidApplicationEdgeConfiguration:
      properties:
        error_code:
          $ref: '#/components/schemas/InvalidApplicationErrorCode'
        message:
          type: string
          title: Message
        from_node_id:
          type: string
          title: From Node Id
        to_node_id:
          type: string
          title: To Node Id
        from_field:
          type: string
          title: From Field
        to_field:
          type: string
          title: To Field
      type: object
      required:
        - error_code
        - from_node_id
        - to_node_id
        - from_field
        - to_field
      title: InvalidApplicationEdgeConfiguration
      description: Raised when application edge configuration is invalid
    InvalidApplicationNodeConfiguration:
      properties:
        error_code:
          $ref: '#/components/schemas/InvalidApplicationErrorCode'
        message:
          type: string
          title: Message
        node_id:
          type: string
          title: Node Id
      type: object
      required:
        - error_code
        - node_id
      title: InvalidApplicationNodeConfiguration
      description: Raised when application node configuration is invalid
    InvalidApplicationNodeConfigurationField:
      properties:
        error_code:
          $ref: '#/components/schemas/InvalidApplicationErrorCode'
        message:
          type: string
          title: Message
        field:
          type: string
          title: Field
        node_id:
          type: string
          title: Node Id
      type: object
      required:
        - error_code
        - field
        - node_id
      title: InvalidApplicationNodeConfigurationField
      description: Raised when a field in node configuration is invalid
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ApplicationProcessingErrorCode:
      type: string
      enum:
        - APPLICATION_PROCESSING_MISSING_REQUIRED_CONFIGURATION
        - APPLICATION_PROCESSING_MISSING_REQUIRED_INPUT
        - APPLICATION_PROCESSING_INVALID_USER_INPUT
        - APPLICATION_PROCESSING_MISSING_REQUIRED_APPLICATION_OUTPUT
        - APPLICATION_PROCESSING_NODE_PROCESSOR_MISSING
        - APPLICATION_PROCESSING_EXTERNAL_REQUEST_TIMED_OUT
        - APPLICATION_PROCESSING_EXTERNAL_REQUEST_ERRORED
        - APPLICATION_PROCESSING_EXCEEDING_CONTEXT_WINDOW
        - APPLICATION_PROCESSING_UNEXPECTED
      title: ApplicationProcessingErrorCode
    MachineState:
      properties:
        current_node:
          type: string
          title: Current Node
        state:
          additionalProperties: true
          type: object
          title: State
      type: object
      required:
        - current_node
        - state
      title: MachineState
    LegacySpan:
      properties:
        workflow_id:
          type: string
          title: Workflow Id
        node_id:
          type: string
          title: Node Id
        operation_type:
          type: string
          title: Operation Type
        start_timestamp:
          type: string
          title: Start Timestamp
        operation_input:
          type: string
          title: Operation Input
        operation_output:
          type: string
          title: Operation Output
        operation_metadata:
          title: Operation Metadata
          additionalProperties: true
          type: object
        duration_ms:
          type: integer
          title: Duration Ms
      type: object
      required:
        - workflow_id
        - node_id
        - operation_type
        - start_timestamp
        - operation_input
        - operation_output
        - duration_ms
      title: LegacySpan
    NodeSchemaId:
      type: string
      enum:
        - text_input_schema
        - text_output_schema
        - knowledge_base_input_schema
        - knowledge_base_schema
        - multi_knowledge_base_input_schema
        - multi_knowledge_base_schema
        - reranker_schema
        - prompt_engineering_schema
        - completion_model_input_schema
        - completion_model_schema
        - external_endpoint_schema
        - document_input_schema
        - map_reduce_schema
        - document_search_schema
        - document_prompt_schema
      title: NodeSchemaId
    ConfigurationFieldValue:
      properties:
        value:
          title: Value
      type: object
      required:
        - value
      title: ConfigurationFieldValue
    InvalidApplicationErrorCode:
      type: string
      enum:
        - INVALID_APPLICATION_NO_INPUT_NODE
        - INVALID_APPLICATION_NO_OUTPUT_NODE
        - INVALID_APPLICATION_EDGE_NO_INPUT_FIELD
        - INVALID_APPLICATION_EDGE_NO_OUTPUT_FIELD
        - INVALID_APPLICATION_EDGE_TYPE_MISMATCH
        - INVALID_APPLICATION_NODE_TYPE_MISMATCH
        - INVALID_APPLICATION_NODE_FIELD_INVALID
        - INVALID_APPLICATION_NODE_FIELD_BUSINESS_ERROR
        - INVALID_APPLICATION_NODE_REQUIRED_INPUT_NOT_CONNECTED
        - INVALID_APPLICATION_NO_PROCESSOR_FOR_NODE_TYPE
        - INVALID_APPLICATION_INVALID_GRAPH
        - INVALID_NODE_OVERRIDE
      title: InvalidApplicationErrorCode

````