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.0.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.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_valta-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 6745ce9d79c9f174cb9829c05fbe3db89bf607183e571d8bb8f8087e863cdfe8
MD5 e8d45ff0b563f3bd7c18b1188f7316a7
BLAKE2b-256 338f31ac1696e4f460d08351c316642a7059581fe2d86a6c4b002f5efc5c473b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for langchain_valta-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b9ad94d4b33c1b8aa1d691505e0924961783e045bb4e61f4dd6957a49ed8e63
MD5 ddac8474cc2892e561b39fad953c9426
BLAKE2b-256 d74b6e347e50b65f060bf6f6fd784eb8df9147e49df4ed205b2514df21d328d8

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