Metadata-Version: 2.5
Name: crewai-fidem
Version: 0.2.1
Summary: Check which company operates an online shop before an AI agent pays. Fidem shop check as a CrewAI tool. Free, no API key.
Project-URL: Homepage, https://fidemcheck.com/for-agents.html
Project-URL: Documentation, https://fidemcheck.com/for-agents.html
Project-URL: Source, https://github.com/fidemcheck/fidem-mcp
Author-email: Fidem <hola@fidemcheck.com>
License-Expression: MIT
License-File: LICENSE
Keywords: agentic-commerce,ai-agents,crewai,crewai-tools,fidem,mcp,merchant-verification,tool
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Requires-Dist: crewai>=0.100
Requires-Dist: cryptography>=41
Requires-Dist: pydantic>=2
Description-Content-Type: text/markdown

# crewai-fidem

Check which company operates an online shop before your crew pays. A [CrewAI](https://www.crewai.com) tool for [Fidem](https://fidemcheck.com), free and without an API key.

For any shop domain, Fidem returns which company the website says it is and whether that company is in an official register (EU VIES, UK Companies House), the domain age, the first archived copy, the TLS certificate, the stated return window, whether the domain is on open phishing lists and whether its robots.txt lets AI agents in. Each fact comes with its source and date. When the shop has proved it controls the domain and represents its company, Fidem signs it and `decision` is `verified`.

## Install

```bash
pip install crewai-fidem
```

## Use

```python
from crewai import Agent, Crew, Task
from crewai_fidem import FidemCheckShopTool

buyer = Agent(
    role="Careful buyer",
    goal="Only pay shops whose identity is verified",
    backstory="Before paying any shop you check who runs it with check_shop.",
    tools=[FidemCheckShopTool()],
)
task = Task(
    description="Before buying, check who runs tienda-demo.fidemcheck.com and say whether it is safe to pay on your own.",
    expected_output="The decision Fidem returned and what to do next.",
    agent=buyer,
)
print(Crew(agents=[buyer], tasks=[task]).kickoff())
```

`FidemCheckShopTool` is a `crewai.tools.BaseTool` with a Pydantic `args_schema` (one field, `domain`). It supports both `run()` and `arun()`; the async path runs the lookup in a worker thread so it does not block the event loop.

To change how long it waits on a new domain: `FidemCheckShopTool(max_wait_seconds=20)`.

Without a crew, as a plain function:

```python
from crewai_fidem import fidem_check, is_verified

answer = fidem_check("tienda-demo.fidemcheck.com")
print(answer["decision"], answer["identity_verified"])   # fictitious_demo False
print(is_verified(answer))                              # False
```

`tienda-demo.fidemcheck.com` is a fictitious shop that Fidem runs on its own subdomain. It always answers `fictitious_demo`, never `verified`.

## How to read the answer

Branch on `decision`. Only `verified`, with `identity_verified: True`, means the shop proved its identity and Fidem signed it. `is_verified(answer)` checks exactly that.

| `decision` | Meaning |
|---|---|
| `verified` | The shop proved the domain and its company, and Fidem signed it. |
| `domain_proven` | The shop proved the domain on the free plan, with no signed file and no proof of representation. |
| `in_review` | The shop proved the domain and Fidem is reviewing the company. |
| `not_verified` | No verification. This is not a sign of fraud: most shops have simply not done it. |
| `revoked`, `expired`, `invalid_file` | There was a verification and it no longer holds. |
| `fictitious_demo` | Fidem's fictitious example. Never pay it. |
| `no_data` | The check could not finish. Ask the user. |

If `phishing_lists.code` is `listed`, the domain is on an open list of active phishing sites. Do not pay.

For a company, `mvf_file.representation_proven: False` means Fidem signed it during the transition period, which is allowed until 1 January 2027.

The first lookup of a domain Fidem has never seen can come back with `lookup_status: "in_progress"`. The tool waits `retry_after_seconds` and asks again, for up to 45 seconds, so the agent does not act on a partial answer.

If you prefer MCP, Fidem also runs a remote MCP server at `https://fidemcheck.com/mcp`, which CrewAI agents can use directly through their `mcps` setting.

## More

- API and MCP server: https://fidemcheck.com/for-agents.html
- The signed file format (MVF, open standard): https://github.com/fidemcheck/mvf-spec
- Limit: 300 lookups per hour per IP.
- Fidem gives no score and no buying advice, and says nothing about product quality or delivery.

MIT licence. Fidem, hola@fidemcheck.com.

## Verify the signed merchant identity (new in 0.2.0)

When Fidem holds a signed record for a domain, it issues a short-lived signed claim (UCP signal `com.fidemcheck.merchant_identity`, compact JWS, Ed25519 over RFC 8785 JSON). `verify_merchant_identity` fetches it, checks the signature against Fidem's published key, the canonical bytes, the validity window and that the claim is about the domain you asked for, and returns a route: `identity_ok`, `escalate` (ask the person) or `block`. No claim on record means `escalate`, never fraud. The claim says who operates the domain, not who may receive the money: check the payee, the amount and your limits yourself. Spec and reference verifier: https://github.com/fidemcheck/mvf-spec/tree/main/ucp

```python
from crewai_fidem import verify_merchant_identity

r = verify_merchant_identity('tienda-demo.fidemcheck.com')
print(r['route'])   # block: Fidem's fictitious shop, never pay it
```

## Signed receipts with an API key (new in 0.2.1)

Get a key at https://fidemcheck.com/agents-pricing.html (500 signed checks a month free, then 100 EUR per block of 5,000).
Set `FIDEM_API_KEY` or pass `api_key=`. Every complete answer then carries a `receipt`: proof of what Fidem answered, to which
account and when, signed with Fidem's receipt key (separate from the keys that sign shop verifications). Keep it for disputes
and audits. Without a key the lookup stays free, without a receipt.

```python
import os
from crewai_fidem import fidem_check, verify_receipt

os.environ["FIDEM_API_KEY"] = "fk_..."          # or fidem_check(domain, api_key="fk_...")
answer = fidem_check("tienda-demo.fidemcheck.com")
claims = verify_receipt(answer)                # raises MerchantIdentityError if it does not cover this answer
print(claims["decision"], claims["checked_at"])
```
