Skip to content

Repository files navigation

Reflection Agent

An AI-powered reflection agent that helps you process and learn from your thoughts, experiences, and reflections. The agent uses LangChain and OpenAI to extract key insights, facts, and actionable plans from your personal reflections.

What it does

The Reflection Agent takes your personal reflections and:

  1. Extracts 5 main points - Identifies the key learnings and insights
  2. Creates a list of facts - Separates objective facts from opinions
  3. Generates an action plan - Creates specific, actionable steps to integrate learnings into daily life
  4. Checks for repetition - Ensures content isn't overly repetitive
  5. Provides a summary - Combines everything into a comprehensive overview

Features

  • Streaming updates - Real-time progress updates via Server-Sent Events
  • REST API - Simple HTTP endpoints for integration
  • Web interface - Built-in frontend for easy interaction
  • Secure - Uses environment variables for API keys

Setup

Prerequisites

  • Node.js (v18 or higher)
  • OpenAI API key

Installation

  1. Clone the repository:
git clone https://github.com/NihaalManaf/Reflection-agent-fresh.git
cd Reflection-agent-fresh
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory:
OPENAI_API_KEY=your_openai_api_key_here
  1. Start the server:
npm start

The server will start on http://localhost:3000

Usage

Web Interface

Visit http://localhost:3000 to use the web interface.

API Endpoints

POST /invoke

Process a reflection and get the complete result.

curl -X POST http://localhost:3000/invoke \
  -H "Content-Type: application/json" \
  -d '{"content": "Your reflection text here"}'

GET /invoke-stream

Process a reflection with streaming updates.

curl "http://localhost:3000/invoke-stream?content=Your%20reflection%20text%20here"

Environment Variables

Variable Description Required
OPENAI_API_KEY Your OpenAI API key Yes
PORT Server port (default: 3000) No

Security

  • API keys are stored in environment variables
  • No sensitive data is committed to the repository
  • Comprehensive .gitignore prevents accidental key exposure

License

MIT License

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages