How to deploy the LangGraph AI Agent Boilerplate

The LangGraph AI Agent Boilerplate contains the configurations for creating intelligent, real-time agents that can query and interact with data stored in an Azion SQL Database, delivering optimized performance and reduced latency for your applications.

This template is built to leverage Azion’s robust edge computing infrastructure, ensuring scalability, security, and seamless integration with SQL Database.

The deployment of this template will create an SQL Database with two tables: one for conversation history and another for reference documents. It also creates a backend application developed with LangGraph for document management and agent functionality, and a Vue-based frontend for user interaction.

This template uses Vue version 3.3.4.


Requirements


Deploying the template

You can obtain and configure your template through the Azion Console. To easily deploy it at the edge, click the button below.

Deploy

Setting up the template

In the configuration form, you must provide the information to configure your application. Fill in the presented fields.

Fields identified with an asterisk are mandatory.

  1. Connect Azion with your GitHub account.
    • A pop-up window will open to confirm the installation of the Azion GitHub App, a tool that connects your GitHub account with Azion’s platform.
    • Define your permissions and repository access as desired.
  2. Select the Git Scope to work with.
  3. Define a name for your agent.
    • By default, the name of the database follows the pattern <agent_name>-database.
    • Use a unique and easy-to-remember name. If the name has already been used, the platform returns an error message.
  4. Insert your OpenAI API key.
  5. Define the authentication method for accessing the agent. For each method you can choose, provide the necessary information:
    • No Auth: no authentication is required. Leave the fields blank.
    • Basic Auth: provide the token/password for basic authentication.
    • Clerk Auth: insert the Clerk public and private keys for authentication through this service. You can configure the rules for the authentication process in the dashboard of your Clerk account.
  6. Click the Deploy button to start the deployment process.

During the deployment, you’ll be able to follow the process through a window showing the logs. When it’s complete, the page shows information about the application and some options to continue your journey.


Managing the template

Setting up the database

This template creates two tables in the database, one for conversation history and another for reference documents. To start using your own documents, you must set up the database by following these steps:

  1. Access the Github repository for the backend application created during the deployment. Its name will be similar to <your-agent-name>-backend-agent.

  2. You must have a .env file with your environment variables in it. If you want to create a new one, it must follow the structure below:

    Terminal window
    AZION_TOKEN="azion_token"
    OPENAI_API_KEY="your_openai_key"
    OPENAI_MODEL= 'gpt-4o'
    EMBEDDING_MODEL= 'text-embedding-3-small'
    # EdgeSQL database and table names. Usually, table names are not changed,
    # and the database name is the name of your agent + database: agent_name_database
    MESSAGE_STORE_DB_NAME="yourdb-database"
    MESSAGE_STORE_TABLE_NAME='messages'
    VECTOR_STORE_DB_NAME="yourdb-database"
    VECTOR_STORE_TABLE_NAME='vectors'
    # Optional: Langsmith to trace the requests and responses
    LANGSMITH_API_KEY=
    LANGCHAIN_PROJECT=
    LANGCHAIN_TRACING_V2=false
    # Optional: Clerk authentication with your frontend
    CLERK_PUBLISHABLE_KEY=
    CLERK_SECRET_KEY=

    Note that not all environment variables are required. Check details on the table below.

    Environment variableDescriptionRequired
    AZION_TOKENThe token for authenticating with Azion’s platform.Yes
    OPENAI_API_KEYYour API key for accessing OpenAI services.Yes
    OPENAI_MODELThe OpenAI model to be used for processing. If not set, defaults to gpt-4o.No
    EMBEDDING_MODELThe model used for generating embeddings. If not set, defaults to text-embedding-3-small. To use a different model, you must create a database with columns configured for the same model.No
    LANGSMITH_API_KEYAPI key for accessing Langsmith services.No
    LANGCHAIN_PROJECTThe Langchain project identifier.No
    LANGCHAIN_TRACING_V2Enables or disables Langchain tracing (set to true or false).No
    MESSAGE_STORE_DB_NAMEThe database name for storing conversation history messages. By default, it is the same as the database for the documents. Default name: <agent-name>-database.Yes
    MESSAGE_STORE_TABLE_NAMEThe table name within the messages database for storing the conversation history. Default name: messages.Yes
    VECTOR_STORE_DB_NAMEThe database name for storing your documents as vector embeddings. By default, it is the same as the database for the messages. Default name: <agent-name>-database.Yes
    VECTOR_STORE_TABLE_NAMEThe table name within the documents database for storing embeddings. Default name: vectors.Yes
  3. Go to the project’s migrations folder and run the vector database setup with:

    Terminal window
    yarn setup
    • The project uses two main files to configure and initialize the databases:

      • Vector Database (RAG)

        • The file migrations/setupDatabase.ts is responsible for:
          • Configuring the vector database using AzionVectorStore.initialize()
          • Creating the vectors table with the appropriate embedding column (e.g., F32_BLOB(1536) when EMBEDDING_MODEL=text-embedding-3-small)
      • Message Database (Tracing)

        • The file src/services/edgeSqlTracerService.ts automatically manages:
          • The creation of the message database (if it doesn’t exist)
          • The creation of the messages table using the DDL generated by createSetupTableStatement()
          • Configuration is done on demand through the handleErrors method

    You can edit these files to customize the database configuration according to your specific needs.

    • Available Configuration Methods

      • The project offers two approaches to configure the vector database in the migrations/setupDatabase.ts file:

        • Active Method (in use)

          AzionVectorStore.initialize(embeddingModel, { dbName, tableName }, { mode: "hybrid", columns: ["*"] })
          
        • Alternative Method (commented)

          // const vectorStore = new AzionVectorStore(...);
          // await vectorStore.setupDatabase({ mode: "hybrid", columns: ["*"] });
          
  4. To add your own documents to the RAG system:

    • Place your document files in the folder migrations/files/. The system supports the following formats: PDF, Markdown (.md), Text (.txt), JSON.

    • If the ‘files’ folder does not exist yet, create it.

    • How It Works:

      • The file migrations/uploadDocs.ts processes documents through the function getDocsFromFolder("migrations/files"), which:
        • Reads all supported files from the specified folder
        • Splits the content into smaller chunks
        • Inserts the chunks into the vector store for semantic search
    • Customizing the Path

      • If you prefer to use a different folder for your documents, edit the file migrations/uploadDocs.ts and change the argument of the getDocsFromFolder() function:
      // Example: changing to a custom folder
      const docs = await getDocsFromFolder("my-custom-folder");
      
    • Uploading Documents

      • After adding your files, execute:
      yarn upload-docs
      

The database with reference documents is now ready and available for your application to access it. Read the template documentation for more details on how to configure the project.

Managing the application

Considering that this initial setup may not be optimal for your specific application, all settings can be customized any time you need by using the Azion Console.

To manage and edit your application’s settings, follow these steps:

  1. Access Azion Console.
  2. On the upper-left corner, select Products menu > Applications.
    • You’ll be redirected to the Applications page. It lists all the applications you’ve created.
  3. Find the application related to your template and select it.
    • The list is organized alphabetically. You can also use the search bar located in the upper-left corner of the list; currently, it filters only by Application Name.

After selecting the application you’ll work on, you’ll be directed to a page containing all the settings you can configure.

Adding a custom domain

The application created during the deployment has an assigned Azion Workload domain to make it accessible through the browser. The domain has the following format: xxxxxxxxxx.map.azionedge.net/. However, you can add a custom domain for users to access your application through it.

Go to Configuring a Domain Guide