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

# Enhance Assistant Instructions

> Enhance an assistant's instructions using an LLM. The endpoint reads the assistant's current instructions and tools, then streams back improved instructions as they are generated.

Optionally provide an `enhancement_prompt` to steer the changes (for example, "make the instructions more concise" or "add error handling guidance"). When omitted, the assistant's existing instructions are used as the basis for the enhancement.

The enhancement focuses on tool-calling reliability, clarity and precision, completeness and error handling, tool schema alignment, and conversation flow structure.

The response is streamed as `text/plain` using chunked transfer encoding; consume the body incrementally to render the enhanced instructions as they arrive.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/ai/assistants.yml post /ai/assistants/{assistant_id}/instructions/enhance
openapi: 3.1.0
info:
  title: Telnyx AI Assistants API
  version: 2.0.0
  description: >-
    API for managing AI Assistants, including CRUD fields, versions, tags,
    integrations, MCP servers, and shared tools.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /ai/assistants/{assistant_id}/instructions/enhance:
    post:
      tags:
        - Assistants
      summary: Enhance Assistant Instructions
      description: >-
        Enhance an assistant's instructions using an LLM. The endpoint reads the
        assistant's current instructions and tools, then streams back improved
        instructions as they are generated.


        Optionally provide an `enhancement_prompt` to steer the changes (for
        example, "make the instructions more concise" or "add error handling
        guidance"). When omitted, the assistant's existing instructions are used
        as the basis for the enhancement.


        The enhancement focuses on tool-calling reliability, clarity and
        precision, completeness and error handling, tool schema alignment, and
        conversation flow structure.


        The response is streamed as `text/plain` using chunked transfer
        encoding; consume the body incrementally to render the enhanced
        instructions as they arrive.
      operationId: >-
        enhance_assistant_instructions_public_assistants__assistant_id__instructions_enhance_post
      parameters:
        - name: assistant_id
          in: path
          description: Unique identifier of the assistant.
          required: true
          schema:
            type: string
            title: Assistant Id
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EnhanceInstructionsRequest'
      responses:
        '200':
          description: >-
            A stream of enhanced instruction text. The body is sent as
            `text/plain` using chunked transfer encoding.
          content:
            text/plain:
              schema:
                type: string
                title: Enhanced Instructions Stream
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.ai.assistants.instructions.enhance('assistant_id');


            console.log(response);
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            response = client.ai.assistants.instructions.enhance(
                assistant_id="assistant_id",
            )
            print(response)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.AI.Assistants.Instructions.Enhance(\n\t\tcontext.TODO(),\n\t\t\"assistant_id\",\n\t\ttelnyx.AIAssistantInstructionEnhanceParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.ai.assistants.instructions.InstructionEnhanceParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    String response = client.ai().assistants().instructions().enhance("assistant_id");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            response = telnyx.ai.assistants.instructions.enhance("assistant_id")

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->ai->assistants->instructions->enhance(
                'assistant_id',
                enhancementPrompt: 'enhancement_prompt',
                instructions: 'instructions',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx ai:assistants:instructions enhance \
              --api-key 'My API Key' \
              --assistant-id assistant_id
components:
  schemas:
    EnhanceInstructionsRequest:
      properties:
        enhancement_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Enhancement Prompt
          description: >-
            Optional guidance describing how the instructions should be
            enhanced. When provided, the LLM applies these requested changes in
            addition to fixing any identified issues.
        instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: Instructions
          description: >-
            The instructions to enhance. When omitted, the assistant's existing
            instructions are used.
      type: object
      title: EnhanceInstructionsRequest
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````