Metadata-Version: 2.4
Name: langchain-valta
Version: 0.1.1
Summary: LangChain tool for hard spending limits on AI agents via Valta
Author-email: Valta <debo@valta.co>
License: MIT
Project-URL: Homepage, https://valta.co
Project-URL: Documentation, https://valta.co/docs
Project-URL: Repository, https://github.com/billionaire664/valta.co
Project-URL: Bug Tracker, https://github.com/billionaire664/valta.co/issues
Keywords: langchain,ai,agents,spending,budget,cost-control,policy,guardrails
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0.0
Dynamic: license-file

# langchain-valta

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

## Install

```bash
pip install langchain-valta
```

## Quickstart

```python
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](https://valta.co/dashboard/policies). Changes take effect immediately — no redeploy needed.

## Links

- [valta.co](https://valta.co)
- [Documentation](https://valta.co/docs)
- [Get an API key](https://valta.co/dashboard/api-keys)
