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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c15b23a1a07c3fba1cdf58a787de5ae8a3abf63b125020af99bf674b00d3ab3
|
|
| MD5 |
f4be33ddb512fe90b3abb715ef65b74b
|
|
| BLAKE2b-256 |
0ee1b8d083d9e154621c1b63e03e9c7bcabc1c98b9c5aaa6d214b36e93b249b5
|
File details
Details for the file langchain_valta-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_valta-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f1178ce65e7108c6f7d05b0132dfe3c8b00ad1d4adf47202a59fd899734de09
|
|
| MD5 |
2bd9647a26964df4acf1c831bd11c23c
|
|
| BLAKE2b-256 |
38ca0aef0aaa66c58c52d65370ce8a24f128bc188cf6c2efd4f2b895f0b600b0
|