Skip to main content

Add Ollama Python Tool to AI Agent

Quick Start

1

Set Up Ollama

Make sure you have Ollama installed and running locally:
2

Create a file

Create a new file ollama_stock.py with the following code:
3

Install Dependencies

Make sure you have the required packages installed:
4

Run the Agent

Execute your script:
Requirements
  • Python 3.10 or higher
  • Ollama installed and running locally
  • yfinance and mcp packages installed

Features

Local LLM

Run models locally using Ollama without relying on external APIs.

Stock Data

Retrieve real-time stock price information using the yfinance library.

Python MCP

Use Python-based MCP servers for custom tool functionality.

Privacy-Focused

Keep sensitive data local with on-device inference.