Skip to main content

A toolset for agentic workflows

Project description

agentic-tools

A python package that lets you setup agents with tools very easy

drawing

All you need is to add a docorator do the function that should be made accessable to the LLM.

from agentic_tools import ai_tool

def my_function_that_an_llm_can_not_use():
    pass 

@ai_tool
def my_function_that_an_llm_can_use():
    pass

Be awere that this will eat more input tokens, since you are adding context of the functions.

install

pip install agentic-tools 

Agentic tools needs a LangChain object chat model.

build

git clone git@github.com:AxelGard/agentic-tools.git
cd agentic-tools
python3 -m venv env 
source ./env/bin/activate
pip install -e .
# or 
# pip install -e .[dev] 
# if you want dev depenacies 

DEMO

you can check out my expriment notebook

or

suppose you have some functions that you want you LLM to be able to call. Agentic tools allows you to just add a decorator to it and then the agent will have access to those tools.

All LangChain models are supported, but for this demo I will use Ollama with llama3.1

install

install Ollma

curl -fsSL https://ollama.com/install.sh | sh

and then run ollama

ollama run llama3.1

install the python dependacnices

pip install agentic-tools langchain-ollama yfinance

Example

from langchain_ollama.chat_models import ChatOllama
from agentic_tools import ai_tool, Agent
import yfinance as yf


@ai_tool
def get_stock_price(symbol: str, period:str="1d") -> str:
    stock = yf.Ticker(symbol)
    price = stock.history(period=period)["Close"].iloc[0]
    return f"The stock price of {symbol} was ${price:.2f} {period} ago"

@ai_tool
def get_market_cap(symbol: str) -> str:
    stock = yf.Ticker(symbol)
    cap = stock.info.get("marketCap", None)
    if cap:
        return f"The market cap of {symbol} is ${cap:,}"
    return f"Market cap data for {symbol} is not available."

@ai_tool
def get_pe_ratio(symbol: str) -> str:
    """ Will return P/E ratrio of the company """
    stock = yf.Ticker(symbol)
    pe = stock.info.get("trailingPE", None)
    if pe:
        return f"The P/E ratio of {symbol} is {pe:.2f}"
    return f"P/E ratio data for {symbol} is not available."


llm = ChatOllama(model="llama3.1", temperature=0)
agent = Agent(llm_chat_model=llm)

query = "what was apples stock price a 5 days ago?"
print(f"{agent.query(question=query)}\n")

query="who are you?"
print(f"{agent.query(question=query)}\n")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentic_tools-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentic_tools-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file agentic_tools-0.1.0.tar.gz.

File metadata

  • Download URL: agentic_tools-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for agentic_tools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2becc87171e997fe026a67df0935636b1870ec667d4ab71bb00b19d7eb1c23d9
MD5 e017f0f623d131d5bb9e8dfc2f3b9b23
BLAKE2b-256 3cc8ab9a0a3a2bdfb1ba7a19e7e8ee5334eec1d3b1ba1e7dd129415d952dbd1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentic_tools-0.1.0.tar.gz:

Publisher: release.yaml on AxelGard/agentic-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agentic_tools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentic_tools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for agentic_tools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee5ed9cd9d724e77fa0d4513ce78766c3abc68c1e72a9955a43a09e198598e87
MD5 3d7f465161c2b475032d18229338ef4b
BLAKE2b-256 425447940749bd41820af9270b4d5e6b76880129d0a30ee6ad433a57edf815ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for agentic_tools-0.1.0-py3-none-any.whl:

Publisher: release.yaml on AxelGard/agentic-tools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page