1

Install Required Packages

First, install all necessary packages:

2

Set Up Environment Variables

Configure your API keys:

Replace the API keys with your actual Composio and OpenAI API keys.

3

Authenticate GitHub Account

If you haven’t authenticated your GitHub account, complete the authentication process.

4

Set up FastAPI Imports

Create a new file main.py and add the necessary imports:

5

Create Request Model

Define the Pydantic model for request validation:

Pydantic ensures that incoming requests contain a valid task field.

6

Initialize API Clients

Set up the OpenAI and Composio clients:

This step prepares the tools needed for GitHub interactions.

7

Create API Endpoint

Add the endpoint that will process tasks:

This endpoint combines OpenAI’s language understanding with Composio’s GitHub tools to process natural language requests.

8

Run the Server

Start your FastAPI server:

The --reload flag enables auto-reload during development. Remove it in production.

9

Test the Endpoint

Test your endpoint using curl:

10

Use specific actions (Optional)

You can use specific actions by passing the action IDs while fetching tools. It’s recommended to limit the number of actions to 20 or fewer for optimal performance and clearer AI responses: