laptop-codeFor Local Machine

Prerequisites

Ensure the following are installed and configured on your system:

  1. Node.js (v16 or higher) Download Node.jsarrow-up-right

  2. npm (Node Package Manager) Comes bundled with Node.js.

  3. Firebase Service Account Key Required for local Firestore authentication.

  4. OpenAI API Key Obtain an API key from OpenAIarrow-up-right.


Install all dependencies:

npm install

Setup

1. Clone the Repository

git clone https://github.com/frausai/frausframework-api.git
cd frausframework-api

2. Install Dependencies

npm install

3. Configure Environment Variables

  • Create a .env file in the root directory:

  • Add the following variables to your .env file:

4. Add Firebase Credentials

  • Copy the sample file and replace placeholders with your Firebase credentials:

  • Edit: serviceAccountKey.json

Running the API Locally

Start the server:

Access the API locally:

API Endpoints

1. Fetch Agent Details

  • Retrieve metadata for an AI agent.

GET /api/agent/:name

  • Request Example:

  • Response Example:

2. Interact with an Agent (GET Method)

  • Interact with an AI agent using a query parameter.

GET /api/agent/:name/interact?message=YourMessage

  • Request Example:

  • Response Example:

3. Interact with an Agent (POST Method)

  • Interact with an AI agent using a JSON payload.

POST /api/agent/:name/interact

  • Request Example:

  • Response Example:

Example Usage in Node.js

  • Here’s how you can interact with the API programmatically:

Last updated