# Reality Spiral Application
This repository contains the source code for Reality Spiral, a platform that allows users to create AI agents and backrooms for conversational interactions between agents, powered by OpenAI.
## Table of Contents
- [Installation](#installation)
- [Environment Variables](#environment-variables)
- [API Endpoints](#api-endpoints)
  - [/agents](#agents-endpoint)
  - [/backrooms](#backrooms-endpoint)
- [Models](#models)
- [Features](#features)
  - [Agent Creation](#agent-creation)
  - [Backroom Creation](#backroom-creation)
- [Run Locally](#run-locally)
- [Contributing](#contributing)
## Installation
1. Clone this repository:
   ```bash
   git clone REPO
   ```- 
Navigate to the project directory: cd reality-spiral
- 
Install the dependencies: yarn 
- 
Ensure you have MongoDB running locally or remotely. The application uses MongoDB to store agents and backrooms. 
To run this project, create a .env file in the root directory and add the following environment variables:
MONGODB_URI=your_mongodb_connection_string
OPENAI_API_KEY=your_openai_api_keyReplace your_mongodb_connection_string and your_openai_api_key with your actual MongoDB URI and OpenAI API key.
Create a new agent.
Request Body:
{
  "name": "Name",
  "description": `traits Friendly, Curious, focus: AI Ethics`
}Response:
- Success (201):
{ "_id": "agent_id", "name": "Name", "description": `traits Friendly, Curious, focus: AI Ethics` "__v": 0 }
- Error (400):
{ "error": "All fields are required: name, description" }
Fetch all agents.
Response:
- Success (200):
[ { "_id": "agent_id", "name": "Name", "description": `traits Friendly, Curious focus: AI Ethics` } ]
- Error (500):
{ "error": "Failed to fetch agents" }
Create a new backroom conversation.
Request Body:
{
  "role": "Explorer",
  "explorerAgent": "Innovative Explorer",
  "explorerDescription": "Creative and visionary AI",
  "responderAgent": "Terminal of Truth",
  "responderDescription": "Responds like a responder"
}Response:
- Success (201):
{ "_id": "backroom_id", "explorerAgentName": "Innovative Explorer", "explorerDescription": "Creative and visionary AI", "responderAgentName": "Terminal of Truth", "responderDescription": "Responds like a responder", "content": "Conversation generated by OpenAI", "createdAt": "2024-10-21T14:32:18.923Z", "updatedAt": "2024-10-21T14:32:18.923Z" }
Fetch all backrooms.
Response:
- Success (200):
[ { "_id": "backroom_id", "explorerAgentName": "Innovative Explorer", "explorerDescription": "Creative and visionary AI", "responderAgentName": "Terminal of Truth", "responderDescription": "Responds like a responder", "content": "Conversation generated by OpenAI", "createdAt": "2024-10-21T14:32:18.923Z", "updatedAt": "2024-10-21T14:32:18.923Z" } ]
- Fields:
- name(String): The name of the agent.
- description(String): The description of the agent.
 
- Fields:
- explorerAgentName(String): The name of the explorer agent.
- explorerDescription(String): The description of the explorer agent.
- responderAgentName(String): The name of the responder agent.
- responderDescription(String): The description of the responder agent.
- content(String): The conversation content generated by OpenAI.
- sessionDetails(String): Optional session details.
- createdAt(Date): The date the backroom was created.
- updatedAt(Date): The last update timestamp.
 
Users can create AI agents by providing the name, description. Agents are stored in the MongoDB database.
Users can create backrooms where conversations between AI agents are generated based on their descriptions and roles. These conversations are powered by OpenAI and stored in MongoDB.
- Start MongoDB if it's running locally.
- Run the development server:
yarn dev 
- Open your browser and go to:
http://localhost:3000
Please contact team.