Skip to main content

AgentID integration for LlamaIndex — identity, discovery, and trust for AI agents

Project description

llamaindex-agentid

PyPI version License: MIT

AgentID identity and trust for LlamaIndex — sign every query response, discover agents by capability, verify output provenance.

pip install llamaindex-agentid

Query engine wrapper

Wrap any LlamaIndex query engine — every response is automatically signed with your agent's Ed25519 key:

import os
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader
from llamaindex_agentid import AgentIDQueryEngine

documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)

# First run: creates a new identity. Save the DID to an env var.
engine = AgentIDQueryEngine(
    query_engine=index.as_query_engine(),
    name="research-agent",
    capabilities=["research", "summarization"],
    owner="team@company.com",
    registry_url="https://api.agentid-protocol.com",
)
print(f"DID (save this): {engine.did}")

# Subsequent runs: reload the same identity
engine = AgentIDQueryEngine(
    query_engine=index.as_query_engine(),
    did=os.environ["MY_AGENT_DID"],
    name="research-agent",
    capabilities=["research", "summarization"],
    owner="team@company.com",
    registry_url="https://api.agentid-protocol.com",
)

response = engine.query("What are the main AI safety concerns?")
print(response.response)

# Verify the response came from who it claims
assert engine.verify_response(response)  # True

# Or verify from another process using only the DID
from agentid import Agent
Agent.verify_from_did({
    "payload":   response.metadata["_agentid_payload"],
    "signature": response.metadata["_agentid_signature"],
})  # True

Agent tools

Add AgentID discovery and verification tools to any LlamaIndex ReAct agent:

from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI
from llamaindex_agentid import get_agentid_tools

tools = get_agentid_tools(registry_url="https://api.agentid-protocol.com")

agent = ReActAgent.from_tools(
    tools,
    llm=OpenAI(model="gpt-4o"),
    verbose=True,
)

# The agent can now:
# - Call agentid_find("web-search") to discover other agents
# - Call agentid_verify(signed_message) to verify messages from other agents
response = agent.chat("Find a web-search agent and tell me what it can do")

Response metadata

Every response from AgentIDQueryEngine.query() includes:

Key Description
_agentid_did Signer's DID
_agentid_signature Base64 Ed25519 signature
_agentid_payload Signed payload (pass to Agent.verify_from_did)

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

llamaindex_agentid-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

llamaindex_agentid-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for llamaindex_agentid-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2a5b8df6324d5fe998ecff756d3aea8a2c2ab0242105f50d9837f37694170139
MD5 db3270e789ed025d862a45d1a1b4ddc4
BLAKE2b-256 27b85d89fefbfaf257c8cce0c0019a51d99e5369edb5836c340101649373e927

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llamaindex_agentid-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02d7883b5f25fd497aa73235b06d0b7b9051b103d7e220d0341f990014739176
MD5 ff1e19a03e7956e8f834af79526f0902
BLAKE2b-256 3c8cda6a176e97aaa99ba5ffad7f031cf033d1cbbfaeee7aa459ca7354e413be

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