Skip to content

TheJayesh25/persistent-github-gpt4o-ai-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

💾 Persistent Github GPT-4o Agent (LangGraph + Streamlit)

A powerful, privacy-conscious AI assistant powered by GitHub-hosted GPT-4o.
Designed with developers in mind, this agent offers persistent session memory, secure token authentication, and extendability for real-world applications.


🔐 Authentication via GitHub Token

  • Secure login via GitHub token (user-provided).
  • Each token is SHA-256 hashed to create a private identifier (user_hash) used to:
    • Track user sessions
    • Prevent token storage
    • Isolate chat histories across users

💡 You can generate a GitHub token from:
https://github.com/settings/tokens


💾 Persistent Memory via SQLite

  • All chat messages are stored in a local database (chat_messages.db).
  • Each user can create and manage multiple chat sessions.
  • All message types (human, AI, function, tool, etc.) are serialized and deserialized correctly.

🧠 LangGraph Architecture

  • Built using LangGraph's StateGraph for controlled message flow.
  • Node function (process) invokes the model and updates memory.
  • Designed to be extensible for:
    • Tool calling
    • Function execution
    • Retrieval-augmented generation

🧠 Highlights

Feature Details
🛡️ Token Hashing Prevents token leaks and supports session-based user isolation
🗃️ Session Management Named session support with persistent conversations
🧠 GPT-4o Integration Uses GitHub's hosted inference endpoint (https://models.github.ai/inference)
🔄 Tool & Function Ready Agent already supports future extensions for tool-calling and more
❌ Invalid Token Check Validates GitHub token via trial request before login
🔄 Logout Flow Secure reset and return to auth gate

📂 Project Structure

├── main.py # Streamlit frontend with authentication and UI
├── agent.py # LangGraph logic and GPT-4o invocation flow
├── github_wrapper.py # Custom wrapper for GitHub-hosted GPT-4o API
├── chat_messages.db # SQLite database for chat/session persistence
├── requirements.txt # Python dependencies
└── README.md # Project overview and usage

⚙️ How to Use

1. Clone the repo:

git clone https://github.com/your-username/GitHub-GPT4o-Agent.git
cd GitHub-GPT4o-Agent

2. Install dependencies:

pip install -r requirements.txt

3. Run it:

streamlit run main.py

4. Provide your GitHub GPT-4o token at login


🔒 Security First

  • GitHub tokens are not stored.
  • All session control is hash-based and local.
  • SQLite stores only messages, not secrets.

🧰 Tech Stack

  • LangGraph & LangChain
  • Streamlit
  • SQLite (for state persistence)
  • GitHub GPT-4o Inference API

📸 Previews

image

image

image

image

🧑‍💻 Author

Jayesh Suryawanshi

  • 🧠 Python Developer | 💡 AI Tools Builder | 🌍 Data & Engineering Enthusiast
  • 📫 LinkedIn

📃 License

MIT License

About

A Streamlit-based AI Agent chatbot built using LangGraph, LangChain and github hosted GPT-4o, with persistent SQLite storage, authentication, session management, and support for tool/function messages with privacy accounted for. Built with modularity and real-world application in mind

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages