Skip to content

1. Introduction

Introduction to the Express Agent tutorial

This tutorial will walk you through the process of building an Express Agent. You can find the full code in the demo/express folder.

We will:

  • Create a workflow with a basic tool-calling agent loop.
  • Add state to the workflow, so that we can track the state of the agent.
  • Add human-in-the-loop to the workflow. Some tools are important enough that we want to ask a human to confirm and review actions.
  • Deploy the workflow to a simple express server.
  • Basic knowledge of TypeScript and Node.js.
  • Basic knowledge of the command line.
  • An OpenAI API key or OpenAI-compatible service

To run the examples, create a new folder and then type the following commands to initialize a new project and to install the required dependencies:

Terminal window
npm init
npm pkg set type=module # Make sure we're using ESM modules
npm add @llamaindex/workflow-core@^1.3.1 express@^5.1.0 openai@^5.7.0 uuid@^11.1.0
npm add -D @types/express@^5.0.0 tsx@^4.20.4

As we’re adding tsx to the project, you can run any example file just by typing: npm run tsx <filename>.