Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A2A Leasing Example

Example project demonstrating Orloj Agent-to-Agent (A2A) interoperability with a LexisNexis-inspired legal research leasing story.

Not affiliated with LexisNexis. LegalVault is a fictional provider standing in for LexisNexis Protégé-style research. No real LexisNexis API calls are made. All case law and Shepard's-style signals are synthetic demo data.

The story

Morgan & Hale LLP, an Am Law 200 firm, is reviewing a SaaS vendor agreement for an M&A client. Their team uses Meridian Contract Intelligence — a third-party due diligence platform with its own LangGraph agent stack (the LangChain consumer in langchain/).

When Meridian's agent encounters an indemnification clause governed by Delaware law, it does not query a case-law database directly. Instead it calls LegalVault's premium research agent (standing in for LexisNexis Protégé) over A2A, passing the clause and jurisdiction. LegalVault returns a structured memo with enforceability assessment, Shepard's-style citation treatment, and recommendations. Meridian synthesizes that into a client-facing due diligence note.

Sample clause: langchain/sample-contract.txt — asymmetric indemnification (uncapped vendor obligation vs. capped customer liability).

sequenceDiagram
  participant Firm as MorganAndHale_Lawyers
  participant Meridian as Meridian_ContractIntelligence
  participant LegalVault as LegalVault_ProtégéMock
  participant Corpus as WASM_ShepardsTools

  Firm->>Meridian: Upload SaaS agreement for M&A review
  Meridian->>Meridian: Own agent parses contract sections
  Meridian->>LegalVault: A2A tasks/send indemnification clause + DE law
  Note over Meridian,LegalVault: Bearer subscription token scoped to legal-vault only
  LegalVault->>Corpus: precedent-search + citation-analysis
  Corpus-->>LegalVault: Holdings + Shepard-style signals only
  LegalVault-->>Meridian: JSON memo enforceability precedents recs
  Meridian-->>Firm: Due diligence memo citing licensed research
Loading

Actors

Actor Real-world analogue Demo stand-in
LexisNexis Data vendor; runs Protégé + proprietary legal corpus LegalVault (Orloj provider) — fictional, LexisNexis-inspired
Meridian Contract Intelligence Third-party legal tech SaaS (Clio/Kira/Luminance-style) LangChain consumer in langchain/
Morgan & Hale LLP Law firm client of Meridian User persona in demo CLI output
Subscription credential Enterprise OAuth/API key from LexisNexis Developer Portal LEGALVAULT_SUBSCRIPTION_KEY (scoped a2a token)

Demo component → LexisNexis product mapping

Demo component LexisNexis real product Notes
legal-research-agent Protégé Legal AI / Lexis+ clause analysis Search → validate → synthesize
precedent-search tool Lexis case law search / Primary Law retrieval Returns holdings, not full opinions
citation-analysis tool Shepard's Citation Service Treatment history, negative signals
legal-glossary (free) Public legal education / marketing tier Upsells to premium
legal-vault (bearer) Protégé API premium embed Subscription required
Agent Card discovery Developer Portal capability docs Public discover, gated invoke
LEGALVAULT_SUBSCRIPTION_KEY Developer Portal OAuth credential Per-customer, scoped, revocable
A2A tasks/send Protégé API "Ask" endpoint Task-oriented, not bulk retrieve
WASM corpus isolation LexisNexis content licensing model Data never leaves vendor boundary
LangChain consumer Firm intranet / legal tech embed What Protégé API targets today

Today vs this demo

LexisNexis today This demo
Wire protocol REST + OAuth via dev.lexisnexis.com A2A JSON-RPC + Agent Cards (Orloj)
Access model Enterprise sales approval Scoped a2a subscription tokens
Integration target Embed Protégé into firm tools Meridian embeds LegalVault via A2A
Data boundary Licensed API responses WASM tools return synthesized results only

LexisNexis does not expose A2A/agent cards today. This demo shows the same leasing business model with A2A as the agent interop layer — composable across LangChain and other agent frameworks without a vendor-specific SDK.

Why agents, not raw database access?

  1. Protect the corpus — LexisNexis licenses content; bulk DB access enables extraction. An agent returns bounded memos (like Protégé "Ask").
  2. Bundle expertise — Shepard's, jurisdiction routing, and synthesis are the product, not raw case text.
  3. Commercial model — Meter research tasks; free glossary upsells to premium Protégé-style agent.
  4. Scoped credentials — Lessee gets invoke-only token, not ops or DB access.
  5. Agent-native distribution — Law firms and legal tech run agent stacks; A2A lets research vendors be composable tools in Meridian's graph.

LegalVault runs Orloj with two A2A-enabled AgentSystems on the same instance:

System Auth Story
legal-glossary spec.a2a.auth: public Free tier — anyone can invoke, no subscription
legal-vault spec.a2a.auth: bearer Premium tier — proprietary corpus, subscription token required

What this demonstrates

Feature How
Two auth modes on one instance legal-glossary public + legal-vault bearer
Per-system A2A enablement AgentSystem.spec.a2a.enabled: true
Admin + public invoke ORLOJ_API_TOKEN for ops; glossary invoke still open
Paywalled premium invoke Scoped a2a token minted via POST /v1/tokens
Cross-platform interop Meridian (LangChain) consumer ↔ LegalVault (Orloj) provider
Proprietary data in Orloj WASM corpus tools on premium agent only

Topology

flowchart TB
  subgraph meridian [Meridian Contract Intelligence]
    Demo[demo.py]
    Demo -->|"subscription key"| VaultRPC
  end

  subgraph orloj [LegalVault Orloj provider]
    GlossaryCard["legal-glossary card"]
    VaultCard["legal-vault card"]
    GlossaryRPC["POST legal-glossary/a2a open"]
    VaultRPC["POST legal-vault/a2a bearer"]
    Glossary[legal-glossary-agent]
    Vault[legal-vault]
    Research[legal-research-agent]
    WASM[WASM corpus tools]
    Vault --> Research --> WASM
    GlossaryRPC --> Glossary
    VaultRPC --> Vault
  end

  Anyone["Any caller"] -->|"no token"| GlossaryRPC
  Demo -->|"discover"| VaultCard
Loading

Quick start

Prerequisites

  • Docker and Docker Compose
  • Orloj v0.17.0+ — published orlojd image (pulled automatically) and orlojctl CLI
  • Anthropic API key (Orloj agents + LangChain consumer)
  • Python 3.11+ (LangChain demos)

Install orlojctl:

# Homebrew
brew tap OrlojHQ/orloj && brew install orlojctl

# Or install script (pin v0.17.0)
curl -sSfL https://raw.githubusercontent.com/OrlojHQ/orloj/main/scripts/install.sh | sh -s -- v0.17.0

1. Configure environment

cp .env.example .env
# ORLOJ_VERSION, ANTHROPIC_API_KEY, secret in orloj/secrets/secret-anthropic.yaml

2. Start stack

make up
make apply

Verify both systems:

curl -s http://localhost:8080/v1/agent-systems/legal-glossary | python3 -c "import sys,json; print(json.load(sys.stdin)['spec']['a2a'])"
# {'enabled': True, 'auth': 'public'}

curl -s http://localhost:8080/v1/agent-systems/legal-vault | python3 -c "import sys,json; print(json.load(sys.stdin)['spec']['a2a'])"
# {'enabled': True, 'auth': 'bearer'}

3. Discovery (both systems)

make demo-discovery

Unauthenticated registry lists only legal-glossary.

4. Public invoke (no token)

make demo-public

Works with or without ORLOJ_API_TOKEN set.

5. Premium blocked without token

legal-vault uses spec.a2a.auth: bearer — no admin token required for this check:

make demo-blocked

Expect JSON-RPC error "target AgentSystem is not available" (HTTP 200, no task created).

6. Premium invoke (subscription key)

Blocking anonymous callers (step 5) does not require ops setup. Letting subscribers in does — the server must validate minted bearer tokens (ORLOJ_API_TOKEN must be set on orlojd).

make setup-ops-auth   # required first — writes ORLOJ_API_TOKEN, restarts orlojd
make setup-paywall    # mints + auto-writes LEGALVAULT_SUBSCRIPTION_KEY to .env
make demo-paid

If make demo-paid returns "target AgentSystem is not available" with empty state= while polling, the subscription key was not accepted — usually because setup-ops-auth was skipped or orlojd was restarted without ORLOJ_API_TOKEN in .env.

7. Control-plane isolation (optional)

Verify the lessee subscription key cannot access Orloj ops APIs:

make demo-control-plane-blocked   # subscription key gets 403 on /v1/tools

Requires make setup-ops-auth + make setup-paywall from step 6.

Command Expected
make demo-public Glossary invoke works without token
make demo-blocked Vault invoke rejected without token (JSON-RPC error or HTTP 401)
make demo-paid Vault invoke works with subscription key
make demo-control-plane-blocked Subscription key 403 on /v1/tools

8. LangChain demo (Meridian → LegalVault)

make demo-langchain

Uses ORLOJ_AGENT_SYSTEM=legal-vault by default. Meridian calls LegalVault over A2A via the query_lexis_research tool and synthesizes a client memo. For raw LegalVault output without LangChain orchestration: make demo-langchain -- --direct-a2a.

Target Purpose
make setup-ops-auth Generate/write ORLOJ_API_TOKEN, restart orlojd, apply with admin
make setup-paywall Apply manifests, mint subscription key, write LEGALVAULT_SUBSCRIPTION_KEY to .env
make mint-subscription Mint only (same .env write as setup-paywall)

Auth model

Orloj uses three independent layers.

Layer Config What it controls
Instance auth mode ORLOJ_AUTH_MODE → --auth-mode=off|native Web console login (native = username/password → session cookie). Does not disable per-system A2A auth
Token infrastructure ORLOJ_API_TOKEN, ORLOJ_API_TOKENS, tokens in DB (POST /v1/tokens) Whether bearer tokens are parsed/validated; control-plane access (orlojctl apply, /v1/tools, minting)
Per-system A2A policy AgentSystem.spec.a2a.auth: public | bearer Which AgentSystems accept anonymous invoke vs require bearer

Blocking vs accepting on bearer systems:

Goal Needs instance tokens?
Reject anonymous callers (make demo-blocked) No — spec.a2a.auth: bearer alone
Accept a valid subscription key (make demo-paid) Yes — server must validate bearer tokens

With auth-mode=off and no tokens configured, the control plane is open and bearer systems still block unauthenticated A2A invoke. Once you mint tokens (env or DB), instance token auth activates automatically even if auth-mode stays off.

Who gets which secret:

Secret Who Purpose
ORLOJ_API_TOKEN LegalVault ops Admin bootstrap; control plane + minting; enables bearer validation
LEGALVAULT_SUBSCRIPTION_KEY Premium lessee (e.g. Meridian) Scoped a2a token for legal-vault only — never hand out ORLOJ_API_TOKEN to clients

Web console

The Orloj dashboard and paywalled A2A are not either/or — they use different credentials:

Who Auth
Human in browser ORLOJ_AUTH_MODE=native → sign in → session cookie
Ops (orlojctl, minting) ORLOJ_API_TOKEN in .env
A2A lessee (Meridian) LEGALVAULT_SUBSCRIPTION_KEY

Workflow A — CLI demos only (default)

Leave defaults in .env:

ORLOJ_AUTH_MODE=off
ORLOJ_API_TOKEN=          # empty until paywall demos
make up && make apply
make demo-public
make demo-blocked
# When ready for paid invoke:
make setup-ops-auth && make setup-paywall && make demo-paid

With ORLOJ_AUTH_MODE=off and ORLOJ_API_TOKEN set, the web UI at http://localhost:8080 will 401 on control-plane APIs (worker/dashboard may reload). That is expected — use Workflow B if you need the console.

Workflow B — Web UI + paywalled A2A

Set native auth in .env:

ORLOJ_AUTH_MODE=native
make up
make setup-ops-auth    # bootstraps native admin + ORLOJ_API_TOKEN, then apply
make setup-paywall

With auth-mode=native, Orloj returns admin setup required on protected APIs until the first admin account exists. You can create it in the browser at http://localhost:8080, or let the repo scripts call POST /v1/auth/setup for you (scripts/bootstrap-native-admin.sh — also run automatically from make apply and make setup-ops-auth).

After bootstrap:

  1. Sign in at http://localhost:8080 with ORLOJ_ADMIN_USERNAME / ORLOJ_ADMIN_PASSWORD from .env (session cookie for the UI).
  2. Run make demo-paid or make demo-langchain — lessees still use LEGALVAULT_SUBSCRIPTION_KEY for A2A.

ORLOJ_API_TOKEN stays in .env for orlojctl, token minting, and bearer validation on the server. It is separate from the native web login password.

Related docs

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages