🧠 AgentRank
Temporal-aware embeddings for AI agent memory retrieval.
The Problem
Standard embedding models (OpenAI, Cohere, MiniLM) treat "yesterday" and "6 months ago" identically. For AI agents with long-term memory, this breaks temporal reasoning completely.
AgentRank solves this with embeddings that understand:
- ⏰ When memories happened (temporal awareness)
- 📂 What type of memory it is (episodic, semantic, procedural)
- ⚡ 21% better retrieval on agent memory benchmarks
Installation
pip install agentrank
Quick Start
from agentrank import AgentRankEmbedder
# Load model
model = AgentRankEmbedder.from_pretrained("vrushket/agentrank-base")
# Encode with temporal context
embeddings = model.encode(
texts=["User prefers Python for backend development"],
temporal_info=[7], # 7 days ago
memory_types=["semantic"] # It's a preference
)
# Use embeddings for retrieval
print(embeddings.shape) # [1, 768]
Model Family
| Model | Type | Params | Use Case | HuggingFace |
|---|---|---|---|---|
| AgentRank-Base | Embedder | 149M | Best quality retrieval | vrushket/agentrank-base |
| AgentRank-Small | Embedder | 33M | Fast inference | vrushket/agentrank-small |
| AgentRank-Reranker | Cross-encoder | 149M | Accurate reranking | vrushket/agentrank-reranker |
Two-Stage Retrieval Pipeline
For best results, use a two-stage pipeline:
from agentrank import AgentRankEmbedder
from transformers import AutoModelForSequenceClassification, AutoTokenizer
import torch
# Stage 1: Fast retrieval with embedder
embedder = AgentRankEmbedder.from_pretrained("vrushket/agentrank-base")
query_embedding = embedder.encode(["What's my Python preference?"])
# ... search vector DB → get top-50 candidates ...
# Stage 2: Accurate reranking with cross-encoder
reranker = AutoModelForSequenceClassification.from_pretrained("vrushket/agentrank-reranker")
tokenizer = AutoTokenizer.from_pretrained("vrushket/agentrank-reranker")
def rerank(query, candidates, top_k=10):
scored = []
for memory in candidates:
inputs = tokenizer(query, memory, return_tensors="pt", truncation=True)
with torch.no_grad():
score = torch.sigmoid(reranker(**inputs).logits).item()
scored.append((score, memory))
return sorted(scored, reverse=True)[:top_k]
top_10 = rerank("What's my Python preference?", top_50_candidates)
Benchmarks
| Model | MRR | Recall@1 | Recall@5 | NDCG@10 |
|---|---|---|---|---|
| AgentRank-Base | 0.6496 | 0.4440 | 99.6% | 0.6786 |
| AgentRank-Small | 0.6375 | 0.4460 | 97.4% | 0.6797 |
| MPNet-base-v2 | 0.5351 | 0.3660 | 79.6% | 0.6335 |
| MiniLM-L6-v2 | 0.5297 | 0.3720 | 75.2% | 0.6370 |
+22% MRR improvement over baseline embedding models.
| Reranker | Validation Accuracy | Val Loss |
|---|---|---|
| AgentRank-Reranker | 89.11% | 0.2554 |
Key Features
Temporal Embeddings
10 learnable time buckets encode recency:
- Today/Yesterday, This Week, This Month, Last Quarter, etc.
- Model learns what "recent" means in context
Memory Type Embeddings
Distinguish between:
- Episodic: Events ("We discussed Python yesterday")
- Semantic: Facts/preferences ("User likes Python")
- Procedural: Instructions ("To deploy, run npm build")
Architecture
- Base: ModernBERT-base / MiniLM
- Temporal + Type embeddings added (scaled by 0.1)
- Trained on 500K synthetic agent memory samples
- Hard negative mining with 7 negative types
Works Great With
CogniHive — Multi-agent memory with "who knows what" routing
pip install cognihive
Together: CogniHive routes questions to the right agent, AgentRank retrieves the right memories.
Links
- GitHub: github.com/vmore2/AgentRank-base
- HuggingFace: huggingface.co/vrushket
- CogniHive: pypi.org/project/cognihive
Contact
- Author: Vrushket More
- Email: vrushket2604@gmail.com
- LinkedIn: linkedin.com/in/vrushket-more-07b38b25b
- Issues: GitHub Issues
License
Apache 2.0 — Free for commercial use.
Metadata
Release files for agentrank 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentrank-0.1.3.tar.gz | 7.6 kB | Without provenance | Details for agentrank-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentrank-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for agentrank-0.1.3-py3-none-any.whl |
Total release size: 15.0 kB
Release files / agentrank-0.1.3.tar.gz
| Download URL | agentrank-0.1.3.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a89b6ed6c85ee80ec46c06db721e9128b2b7f3c3d0ee8cba2535ebc3af1e045
|
|
BLAKE2b-256 checksum How to use checksums |
5bd7bf14378fe169f2594482636d8ed116bbd02308d1cf670935c476ae3100ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / agentrank-0.1.3-py3-none-any.whl
| Download URL | agentrank-0.1.3-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
76f8597d4a090b12a09f6f798a0929d72ee95476a65f13dd795eb0d7fef8c487
|
|
BLAKE2b-256 checksum How to use checksums |
88208b622c5fb32b9dff4bb8aad973ad40363911d6bb77008f4483a46645fb1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for agentrank 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.