> ## Documentation Index
> Fetch the complete documentation index at: https://learn.orbexa.io/llms.txt
> Use this file to discover all available pages before exploring further.

# AI agent OTR integration patterns

> Technical patterns for integrating OTR trust queries into AI agents — recommendation workflows, caching strategies, and multi-dimensional evaluation

# Agent Integration Patterns

## 9.1 The Trust Decision Workflow

When an AI agent needs to recommend a merchant, the OTR query is one step in a broader decision workflow:

```
User: "Recommend a pair of running shoes"
  |
AI agent searches for candidate merchants (search engine / UCP / product catalog)
  |
Query OTR trust score for each candidate
  |
Composite score = f(product relevance, price, trust score, user preferences)
  |
Rank by composite score and present recommendations to the user
```

The OTR trust score is not the sole ranking factor, but it is a critical signal for AI agents evaluating merchant reliability.

## 9.2 Integration Patterns

### Pattern 1: Real-Time Queries

Call the OTR API in real time for each recommendation:

```javascript theme={null}
async function recommendProducts(query) {
  const candidates = await searchProducts(query);

  // Query trust scores for all candidates in parallel
  const trustScores = await Promise.all(
    candidates.map(c =>
      fetch(`https://orbexa.io/api/otr/verify/${c.domain}`).then(r => r.json())
    )
  );

  // Composite ranking
  return candidates.map((c, i) => ({
    ...c,
    trustScore: trustScores[i].trust_score,
    badge: trustScores[i].badge
  })).sort((a, b) => {
    // Trust score weighted at 30%, price match at 70%
    const scoreA = a.priceMatch * 0.7 + (a.trustScore / 100) * 0.3;
    const scoreB = b.priceMatch * 0.7 + (b.trustScore / 100) * 0.3;
    return scoreB - scoreA;
  });
}
```

### Pattern 2: Cached Queries

Trust scores do not change frequently, making them well-suited for caching:

```javascript theme={null}
const trustCache = new Map();
const CACHE_TTL = 4 * 60 * 60 * 1000; // 4 hours

async function getTrustScore(domain) {
  const cached = trustCache.get(domain);
  if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
    return cached.data;
  }

  const data = await fetch(`https://orbexa.io/api/otr/verify/${domain}`).then(r => r.json());
  trustCache.set(domain, { data, timestamp: Date.now() });
  return data;
}
```

### Pattern 3: MCP Tool Invocation

Through the MCP protocol, AI applications can invoke the OTR query tool directly (see [Chapter 7](/en/book-2/ch7-mcp-server)).

## 9.3 Recommended Trust Score Weights by Scenario

| Scenario                                    | Trust Score Weight | Rationale                                        |
| ------------------------------------------- | ------------------ | ------------------------------------------------ |
| High-value items (over \$500)               | 40-50%             | Higher risk demands stronger trust signals       |
| Mid-range items ($50-$500)                  | 20-30%             | Balance between price and trust                  |
| Low-value items (under \$50)                | 10-20%             | Users are more price-sensitive                   |
| First recommendation of an unknown merchant | 50%+               | No purchase history — trust is the primary basis |

## 9.4 Presenting Trust Information to Users

AI agents can display trust information alongside their recommendations:

```
Recommendation: ExampleStore - Nike Air Max 90
Price: $129.99
Trust Level: GOLD (85)
- Corporate identity verified
- HTTPS + DNSSEC enabled
- 30-day return policy
```

Transparently presenting trust information increases user confidence in the agent's recommendations.

***

**Next chapter**: [How to Improve Your Trust Score](/en/book-2/ch10-improve-score) — A dimension-by-dimension guide to raising your OTR score
