This tutorial guides users through creating LLM apps via the command line interface. For simple applications that can be created from the UI, refer to Getting Started

Prefer video tutorial? Watch our 4-minute video here.


This guide outlines building a basic LLM app with langchain and agenta. By the end, you’ll have a functional LLM app and knowledge of how to use the agenta CLI.

To learn more about creating an LLM app from scratch, please visit our advanced tutorial.

Step 0: Installation

Before beginning, you need to install (or update) the agenta CLI.

pip install -U agenta

Step 1: Initialize a New Project

Create a new folder and initialize it with the following commands:

mkdir example_app; cd example_app
agenta init

Start a new project using the simple_prompt template:

? Please enter the app name company_name_generator
? Are you running agenta locally? Yes
? How do you want to initialize your app? Start from template
? Which template do you want to use? simple_prompt - Simple app that uses one prompt using langchain
App initialized successfully
Please check the for further instructions to setup the template.

The initialization creates several files, including For a detailed explanation, proceed to the next step or continue with the tutorial.

Step 2: Set up the OpenAI API Key

You’ll need to configure the OpenAI API key. Here’s how:

  1. Visit the OpenAI API keys page, and create a new key.

  2. Create a file .env in your project folder and add the line:


Step 3: Run the Application in the Playground

To run your app in the playground, serve it locally using agenta variant serve. This command:

  1. Creates a Docker image and starts a container.
  2. Starts a server exposing the endpoint /generate at localhost/{app_name}/{variant_name}/openapi.json.
  3. Adds the application to the Agenta’s web UI.
agenta variant serve

This will do two things:

  1. It will create a docker image of the application, and start a container based on this image.
  2. The container will start a server exposing an endpoint /generate with the same parameters we specified in the application at localhost/{app_name}/{variant_name}/openapi.json.
  3. It will add the application to the web ui Agenta

Step 4: Start Experimenting

Visit http://localhost, select your app, and experiment with different parameters in the playground.

The playground lets you create new app variants and tweak application parameters.

We hope you find this guide helpful. Happy coding!

Was this page helpful?