Metadata-Version: 2.5
Name: ultrademon
Version: 1.0.0
Summary: Official Python SDK for UltraDemon: Sovereign Autonomous Agent Memory and Sub-10ms Edge Web Search.
Project-URL: Homepage, https://ultrademon.site
Project-URL: Documentation, https://ultrademon.site/guide
Project-URL: Repository, https://github.com/im-ansh/UltraDemon
Project-URL: Changelog, https://github.com/im-ansh/UltraDemon/releases
Project-URL: Issues, https://github.com/im-ansh/UltraDemon/issues
Author-email: UltraDemon Engine <support@ultrademon.site>
Maintainer-email: UltraDemon Engine <support@ultrademon.site>
License: MIT
Keywords: agent-memory,ai-agents,bm25,langchain,mcp,model-context-protocol,search-api,sqlite-fts5,ultrademon,vectorless-memory
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24.0
Provides-Extra: all
Requires-Dist: click>=8.0.0; extra == 'all'
Requires-Dist: langchain-core>=0.1.0; extra == 'all'
Requires-Dist: rich>=12.0.0; extra == 'all'
Provides-Extra: cli
Requires-Dist: click>=8.0.0; extra == 'cli'
Requires-Dist: rich>=12.0.0; extra == 'cli'
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.20.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.1.0; extra == 'langchain'
Description-Content-Type: text/markdown

# UltraDemon Python SDK

Official Python client for UltraDemon: Sovereign Persistent Agent Memory and Sub-10ms Edge Web Search.

## Installation

```bash
pip install ultrademon
```

For LangChain retriever integration:

```bash
pip install "ultrademon[langchain]"
```

## Quickstart

### 1. Web Search (<15ms Edge Retrieval)

```python
from ultrademon import Ultrademon

client = Ultrademon(api_key="ud_live_your_api_key_here")

# Mode 1: Instant sub-15ms search
response = client.search.instant("Frankfurt data center latency benchmarks")
for hit in response.results:
    print(f"{hit.title} -> {hit.url}")

# Mode 2: Hybrid BM25 full-text rank with PageRank
standard_results = client.search.standard("Cloudflare D1 SQLite FTS5")

# Mode 3: Deep research expansion
deep_results = client.search.deep("Autonomous agent persistent memory architectures")
```

### 2. Persistent Memory (Sovereign SQLite FTS5)

```python
# Store long-term knowledge across scales
mem = client.memory.store(
    content="Production database is hosted on Cloudflare D1 in Frankfurt.",
    category="infra",
    container_tag="team_core",
    scale="entity"  # ephemeral, entity, cognitive, or collective
)
print(f"Memory stored: {mem.memory_id}")

# Recall knowledge using BM25 relevance matching
recall_res = client.memory.recall(
    query="Where is our database hosted?",
    container_tag="team_core",
    limit=3
)
for item in recall_res.memories:
    print(f"[{item.score:.2f}] {item.content}")
```

### 3. Asynchronous Client (FastAPI, Asyncio, Agents)

```python
import asyncio
from ultrademon import AsyncUltrademon

async def main():
    async with AsyncUltrademon(api_key="ud_live_...") as client:
        results = await client.search.instant("Anycast edge routing")
        print(f"Found {results.count} results in {results.latency_ms}ms")

asyncio.run(main())
```

### 4. LangChain Integration

```python
from ultrademon.langchain import UltrademonRetriever

retriever = UltrademonRetriever(
    api_key="ud_live_...",
    container_tag="customer_support",
    top_k=5
)

# Use inside any LangChain chain, agent, or runnable
docs = retriever.get_relevant_documents("What is the refund policy?")
for doc in docs:
    print(doc.page_content)
```

### 5. Command-Line Interface (CLI)

```bash
# Search from terminal
ultrademon search "SQLite FTS5 BM25" --mode 1

# Store knowledge
ultrademon memory store "Server configuration note" --category notes

# Recall knowledge
ultrademon memory recall "configuration"

# Check API quota
ultrademon usage
```

## License

MIT
