Skip to main content

LangChain tool for hard spending limits on AI agents via Valta

Project description

langchain-valta

Hard spending limits for LangChain agents. Enforces budget policies before any paid operation fires.

Install

pip install langchain-valta

Quickstart

from langchain_valta import ValtaBudgetTool
from langchain_openai import ChatOpenAI
from langchain.agents import initialize_agent, AgentType

guard = ValtaBudgetTool(
    api_key="vk_live_...",   # from valta.co/dashboard/api-keys
    agent_id="my-agent",
)

agent = initialize_agent(
    tools=[guard, ...your_other_tools],
    llm=ChatOpenAI(model="gpt-4o"),
    agent=AgentType.OPENAI_FUNCTIONS,
    agent_kwargs={
        "system_message": (
            "Before any paid operation, call check_spend with the estimated cost. "
            "Only proceed if the result is 'approved'."
        )
    },
)

How it works

The agent calls check_spend before any paid operation. Valta evaluates the request against the user's policy and returns approved or denied: <reason> before the charge fires.

Response Meaning
approved Spend is within policy — proceed
denied: daily_limit_exceeded Would exceed daily budget
denied: insufficient_balance Wallet balance too low
denied: requires human approval Above approval threshold — check dashboard

Policy management

Set limits at valta.co/dashboard/policies. Changes take effect immediately — no redeploy needed.

Links

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

langchain_valta-0.1.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

langchain_valta-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_valta-0.1.1.tar.gz.

File metadata

  • Download URL: langchain_valta-0.1.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for langchain_valta-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4c15b23a1a07c3fba1cdf58a787de5ae8a3abf63b125020af99bf674b00d3ab3
MD5 f4be33ddb512fe90b3abb715ef65b74b
BLAKE2b-256 0ee1b8d083d9e154621c1b63e03e9c7bcabc1c98b9c5aaa6d214b36e93b249b5

See more details on using hashes here.

File details

Details for the file langchain_valta-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_valta-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f1178ce65e7108c6f7d05b0132dfe3c8b00ad1d4adf47202a59fd899734de09
MD5 2bd9647a26964df4acf1c831bd11c23c
BLAKE2b-256 38ca0aef0aaa66c58c52d65370ce8a24f128bc188cf6c2efd4f2b895f0b600b0

See more details on using hashes here.

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