Skip to content

mohdasaad-debug/agentscope-memory-finance-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

header

typing animation

python ollama yfinance agentscope memory

Overview

AgentScope Memory Finance Bot is a local-first AI finance assistant that combines:

  • Persistent per-user memory stored in SQLite
  • Local LLM inference using Ollama (Llama 3.2)
  • Live market data via yfinance
  • Tool-augmented reasoning using AgentScope ReActAgent

This project is designed for fully local execution (no OpenAI dependency).


Features

  • 🧠 Persistent memory per user (memories/<user_id>.db)
  • 🏦 Stock market quotes via yfinance
  • 🤖 Local LLM via Ollama (llama3.2:3b)
  • 🔧 Tool-based reasoning (ReAct agent architecture)
  • ⚡ Async memory + engine lifecycle management

Project Structure

.
|-- main.py
|-- pyproject.toml
|-- uv.lock
|-- .env (optional, not required for LLM)
`-- memories/      # auto-created at runtime

Local Setup (IMPORTANT)

1. Prerequisites

Install:

  • Python 3.12+
  • Ollama

Check Python:

python --version

2. Install Ollama (Required)

Install Ollama: https://ollama.com/download

Then pull the model:

ollama pull llama3.2:3b

Start server:

ollama serve

Ensure it runs on:

http://localhost:11434

3. Create project

git clone https://github.com/pawan941394/agentscope-memory-finance-bot.git
cd agentscope-memory-finance-bot

or

mkdir agentscope-memory-finance-bot
cd agentscope-memory-finance-bot

4. Virtual environment

python -m venv .venv
source .venv/bin/activate   # mac/linux
.venv\Scripts\activate      # windows

5. Install dependencies

pip install agentscope sqlalchemy aiosqlite yfinance

or

uv sync

Run the app

python main.py

You will see:

Enter user id:

Use same user_id to continue memory across sessions.


How it works (Architecture)

  • Agent: AgentScope ReActAgent
  • Model: Ollama (llama3.2:3b)
  • Memory: AsyncSQLAlchemyMemory (SQLite per user)
  • Tool: Yahoo Finance via yfinance

Tool: Stock Quotes

Example tool input:

AAPL, MSFT, TSLA

Output includes:

  • Price
  • Change
  • Volume
  • Day high/low

Example Prompts

  • “Get AAPL, MSFT and summarize market movement”
  • “Compare NVDA vs AMD performance”
  • “What do you remember about my investing style?”

Memory Design

  • Stored in: memories/<sanitized_user_id>.db
  • Backend: SQLite (async)
  • Session: default_session

Notes

  • Fully local LLM (no OpenAI API required)
  • Market data is via yfinance (may be delayed)
  • Designed for learning agent systems + tool use

Troubleshooting

Ollama not responding

ollama serve

Model missing

ollama pull llama3.2:3b

Import errors

pip install agentscope sqlalchemy aiosqlite yfinance

Roadmap

  • Streamlit UI/FE
  • Multi-agent finance assistant

Contributing

PRs welcome. Keep it simple, local-first, and modular.


License

MIT

footer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages