A lightweight Python service that wraps ThreatRecall's recall API. Ideal for Python agents that want to query CTI via HTTP — handles natural language routing, alias resolution, and graph traversal for you.
Some agent runtimes — especially Python-based — work better over HTTP than directly calling the Node.js API. The sidecar wraps ThreatRecall's recall endpoint and adds:
Create a docker-compose.yml in your project directory.
version: '3.8' services: threatrecall-sidecar: image: ghcr.io/rolandpg/threatrecall-sidecar:latest ports: - "8000:8000" environment: THREATRECALL_API_KEY: "your_api_key_here" THREATRECALL_BASE_URL: "https://app.threatrecall.ai" LOG_LEVEL: "INFO" restart: unless-stopped
Run the sidecar in the background.
docker compose up -d sidecar threatrecall-sidecar
docker compose up -d # start all services defined in the file
http://localhost:8000. Health check at GET /health.Install the client and wire it into your agent.
pip install httpx # or use requests, aiohttp, etc.
import httpx class ThreatRecallSidecar: BASE_URL = "http://localhost:8000" def __init__(self, api_key: str): self.headers = {"Authorization": f"Bearer {api_key}"} def recall(self, query: str) -> dict: response = httpx.get( f"{self.BASE_URL}/recall", params={"q": query}, headers=self.headers, timeout=30.0, ) response.raise_for_status() return response.json() def resolve_alias(self, alias: str) -> dict: response = httpx.post( f"{self.BASE_URL}/resolve", json={"alias": alias}, headers=self.headers, ) response.raise_for_status() return response.json()
Query ThreatRecall with plain English. The sidecar resolves aliases and traverses relationships for you.
from threatrecall_client import ThreatRecallSidecar client = ThreatRecallSidecar(api_key="your_api_key_here") # Natural language query — sidecar handles alias resolution result = client.recall( query="show me all CVEs related to Log4Shell and their associated threat actors" ) print(result["summary"]) for actor in result["actors"]: print(f"- {actor['name']} (confidence: {actor['confidence']})")
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check — returns {"status": "ok"} when running. |
| GET | /recall?q=... |
Natural language query. Resolves aliases and traverses the graph automatically. |
| POST | /resolve |
Resolve a name or alias to a canonical node ID. |
| GET | /graph/:node_id |
Get all edges from a specific node. |
| POST | /query |
Structured graph query with filters (node types, relationship types, confidence thresholds). |
docker compose ps to check. If it's stopped, run docker compose up -d. Check logs with docker compose logs threatrecall-sidecar.
THREATRECALL_API_KEY environment variable in docker-compose.yml is incorrect or missing. Update it with the key from your dashboard.
docker compose logs for cache hit/miss indicators.