Skip to main content

Subtotal AI Toolkit - Python

The Subtotal AI Toolkit library enables popular agent frameworks including LangChain and CrewAI to integrate with the Subtotal API through function calling. The library is not exhaustive of the entire Subtotal API.

Installation

You don't need this source code unless you want to modify the package. If you just want to use the package, just run:

pip install subtotal-ai-toolkit

You can specify the specific optional dependencies you need if you'd like them to be installed by this package. For example, if you intend on using the OpenAI integration, you can run:

pip install subtotal-ai-toolkit[openai]

Optional dependencies include:

  • openai
  • langchain
  • crewai

If you'd like to only install all optional dependencies, you can run:

pip install subtotal-ai-toolkit[all]

Requirements

  • Python 3.11+

Usage

The library needs to be configured with your account's secret API key which is available in your Subtotal Dashboard.

from subtotal_ai_toolkit.crewai.toolkit import SubtotalAIToolkit
from subtotal_ai_toolkit.configuration import Configuration, Tools

subtotal_toolkit = SubtotalAIToolkit(
    secret_key="YOUR_SECRET_KEY",
    configuration=Configuration(tools=[Tools.ALL])
)

NOTE: The toolkit works with LangChain, CrewAI, and OpenAI. The above example is for CrewAI. Use the correct import depending on which framework you're using.

# CrewAI
from subtotal_ai_toolkit.crewai.toolkit import SubtotalAIToolkit

# LangChain
from subtotal_ai_toolkit.langchain.toolkit import SubtotalAIToolkit

# OpenAI
from subtotal_ai_toolkit.openai.toolkit import SubtotalAIToolkit

The toolkit can be passed as a list of tools. For example (using CrewAI):

from crewai import Agent, Task, Crew

subtotal_agent = Agent(
    role="Subtotal Agent",
    goal="Integrate with the Subtotal API effectively to support our business.",
    backstory="You have been using the Subtotal API for a long time.",
    tools=[*subtotal_ai_toolkit.get_tools()],
    allow_delegation=False,
    verbose=True,
)

get_merchants = Task(
    description="Get the list of merchants supported by the Subtotal API.",
    expected_output="merchants",
    agent=subtotal_agent,
)

crew = Crew(
    agents=[subtotal_agent],
    tasks=[get_merchants],
    verbose=True,
    planning=True,
)

crew.kickoff()

Examples for LangChain, CrewAI, and OpenAI are included in the examples directory.

Development

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Metadata

Release files for subtotal-ai-toolkit 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for subtotal-ai-toolkit 0.2.0
File Size Uploaded Provenance Actions
subtotal_ai_toolkit-0.2.0.tar.gz 9.3 kB Without provenance Details for subtotal_ai_toolkit-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for subtotal-ai-toolkit 0.2.0
File Interpreter ABI Platform Actions
subtotal_ai_toolkit-0.2.0-py3-none-any.whl Python 3 none any Details for subtotal_ai_toolkit-0.2.0-py3-none-any.whl

Total release size: 20.2 kB

Release files / subtotal_ai_toolkit-0.2.0.tar.gz

Download URL subtotal_ai_toolkit-0.2.0.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
80ff787ab3a19f86ec6991ae8219f45588041dc34d6e3e352728dff8089c1b4e
BLAKE2b-256 checksum
How to use checksums
c9282344d75f146871cb8ec9ae91842cc372a155b793a693f61ac2f740a245d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / subtotal_ai_toolkit-0.2.0-py3-none-any.whl

Download URL subtotal_ai_toolkit-0.2.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8d8719579fddf26d98e16d9af36334890dcb57605b430ae08037681f5ce8c93d
BLAKE2b-256 checksum
How to use checksums
183ce9130b04529d859283f6ede0139836ed26407b48207fad4ca00333f5d39e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for subtotal-ai-toolkit 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page