Skip to main content

LangChain integration for PQS (Protocol Quality Standard) — Certificate Authority for AI agent economy

Project description

langchain-pqs

LangChain integration for PQS (Protocol Quality Standard) — the Certificate Authority for AI agent economy.

Gives LangChain agents the ability to verify whether an API endpoint is PQS-certified before calling it, and to discover trusted providers from the PQS registry.

Installation

pip install langchain-pqs

Configuration

Set the PQS CA server URL (defaults to http://localhost:4025):

export PQS_CA_URL=http://localhost:4025

Or pass it directly:

from langchain_pqs import PQSVerifyTool

tool = PQSVerifyTool(pqs_ca_url="https://pqs.smartflowproai.com")

Tools

PQSVerifyTool

Check if an API endpoint is PQS-verified:

from langchain_pqs import PQSVerifyTool

verify = PQSVerifyTool()
result = verify.invoke({"endpoint": "https://api.example.com/v1/signals"})
print(result)

Output:

Endpoint: https://api.example.com/v1/signals
Verified: YES
PQS Score: 87
PQS Tier: gold
EAS UID: 0xabc123...
Capabilities: market-signals, risk-scoring
Registered: 2026-04-01T00:00:00Z
Verified at: 2026-04-02T12:00:00Z
Expires: 2027-04-02T12:00:00Z
Owner: ExampleCorp

PQSListProvidersTool

List all verified providers (with optional keyword filter):

from langchain_pqs import PQSListProvidersTool

providers = PQSListProvidersTool()
result = providers.invoke({"filter": "signals"})
print(result)

Usage with LangChain Agent

from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_core.prompts import ChatPromptTemplate
from langchain_pqs import PQSVerifyTool, PQSListProvidersTool

llm = ChatOpenAI(model="gpt-4o")
tools = [PQSVerifyTool(), PQSListProvidersTool()]

prompt = ChatPromptTemplate.from_messages([
    ("system", "You are an AI agent that only calls PQS-verified endpoints. "
               "Always verify an endpoint before using it."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])

agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = executor.invoke({
    "input": "Is https://api.example.com/v1/signals a trusted endpoint?"
})

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_pqs-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_pqs-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file langchain_pqs-0.1.0.tar.gz.

File metadata

  • Download URL: langchain_pqs-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for langchain_pqs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 02c2da1b34c17c2f432b215dc4e16e52c62347a80499c4606f9a568406b6d0c2
MD5 caa2c4745e5c4df4c6c78ef9e10a2e67
BLAKE2b-256 60eb4fa551a729573f32a608af001af7795cb3408d9f9d7f21b548fcf2e15bcd

See more details on using hashes here.

File details

Details for the file langchain_pqs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: langchain_pqs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for langchain_pqs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 99d19d050c69ccf5747e33ac0a5b80238334de8a75dd7cd7397e97749cfcc094
MD5 401f732b9cf03a9d59a6b8c3888f53aa
BLAKE2b-256 be671a7a7036b4c34df886d128cbe21adfbec236f154798334b7e127c8da6dea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page