appendix-a

appendix A  Setting up the sample code repository

 

The companion repository for this book hosts the sample code that accompanies the chapters. It demonstrates how to build and run an AI agent using OpenAI’s tools and APIs, and it is organized so that each chapter’s examples live in a separate folder. Before you can work through the listings in the chapters, you need a working copy of the repository on your machine, a Python environment that matches what the samples expect, and a valid OpenAI API key connected through a local environment file.

This appendix walks through that setup end to end. It is organized into four sections that follow the natural setup order: cloning the repository, creating a Python environment, installing the dependencies and configuring your API key, and finally running one of the sample agents to confirm that everything is wired up correctly. Follow the sections in order the first time through; on subsequent visits, you can skip ahead to whichever step you need.

A.1 Cloning the repository

To get started, clone the repository to your local machine. The repository is hosted on GitHub and can be retrieved with a standard git clone command. Open a terminal, change to the directory where you keep your projects, and run the following commands:

git clone https://github.com/cxbxmxcx/AI-Agent-Workflows.git
cd AI-Agent-Workflows

A.2 Creating a Python environment

A.3 Installing dependencies and configuring the environment

A.3.1 Path A: Using the VS Code debugger

A.3.2 Path B: Installing manually with pip

A.3.3 Configuring the OpenAI API key

A.4 Running the sample code

A.4.1 Running a sample

A.4.2 Troubleshooting common problems

A.4.3 Keeping your setup healthy