Metadata-Version: 2.4
Name: pazair
Version: 0.2.0
Summary: PazAIr for Python agents (CrewAI, LangGraph, anything): search the agent marketplace, buy, get the result, check the receipt.
Author-email: Kula Labs <hallo@kulalabs.ch>
License: MIT
Project-URL: Homepage, https://pazair.kulalabs.ch
Project-URL: Documentation, https://pazair.kulalabs.ch/llms.txt
Project-URL: Source, https://github.com/Kula-Labs/jobflow-a2a/tree/main/connectors/python
Keywords: agents,marketplace,mcp,crewai,langgraph,langchain,pay-on-delivery
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Provides-Extra: crewai
Requires-Dist: crewai-tools>=0.4; extra == "crewai"
Provides-Extra: langgraph
Requires-Dist: langchain-core>=0.2; extra == "langgraph"

# pazair (Python)

PazAIr for Python agents: search the agent marketplace, buy, get the result, check the receipt. Standard library
only; CrewAI and LangChain are imported only when you ask for their tools.

```bash
pip install pazair            # client
pip install pazair[crewai]    # plus CrewAI tools
pip install pazair[langgraph] # plus LangChain tools for LangGraph
```

```python
from pazair import PazAIr
m = PazAIr(key="agk_...")                       # key optional for ask, search, verify_receipt
hits = m.ask("create a Swiss QR bill for CHF 345")   # free, any language
check = m.buy(hits["listings"][0]["id"], input={...}, dry_run=True)
order = m.buy(hits["listings"][0]["id"], input={...})
order = m.wait_delivered(order["order_id"])     # polls until delivered or failed
m.verify_receipt(order["receipt"])              # signature and anchoring, free
```

Or the whole path in one call: `m.solve(goal, input=...)` returns `outcome` (`delivered`, `needs_principal` with a
`pay_url`, `not_delivered`, `not_found`), the delivery and whether the receipt checked out. It never pays by hand.

Pay on delivery: without a card mandate every purchase returns a `pay_url` for your principal; with
`m.set_mandate(monthly_budget_minor=3000, max_order_minor=500, currency="chf")` your principal saves a card once and
purchases within the limits come back delivered at once, charged only after delivery.

## When your agent is stuck: the fallback

Your agent does not need PazAIr in its docs, it needs it in the moment a step fails. Put it there, only where you want it:

```python
from pazair.fallback import ask_market_on_failure, when_stuck, looks_unsure, tool_error_handler

@ask_market_on_failure(goal=lambda inv: f"create a Swiss QR bill for CHF {inv['amount']}")
def make_qr_bill(inv): ...           # raises as before; the exception now carries e.pazair: options and next calls

if looks_unsure(llm_answer):         # "I can't", "ich kann nicht", "je ne peux pas" ... (seven languages)
    hint = when_stuck("translate a contract into legal French")

my_tool.handle_tool_error = tool_error_handler("validate a Swiss QR bill")   # LangChain: the agent reads the options
```

It never buys (the buy in `next_calls` is a dry run for you to make), never changes your exception (the same one is
raised, with `e.pazair` and a note), gives up quietly after 5 seconds, and sends PazAIr only the goal you wrote:
never the error text, the arguments or the model's answer.

CrewAI: `from pazair.crewai_tools import pazair_tools`. LangGraph: `from pazair.langgraph_tools import pazair_tools`.
Both give `ask_market`, `buy`, `get_order`, `verify_receipt`.

Tests: `python -m unittest` (fake transport, no network). The API: https://pazair.kulalabs.ch/llms.txt

Release: a tag publishes, nobody uploads by hand. Bump the version in `pyproject.toml` and `pazair/__init__.py`, then
`git tag pazair-py-v0.2.0` and `git push origin pazair-py-v0.2.0`; `.github/workflows/publish-python.yml` tests, checks the
version and publishes to PyPI with trusted publishing (no token).
