Skip to main content

cortex-client

Thin Python client for Cortex — the rapid web cartographer for AI agents.

Install

pip install cortex-client

Requires the Cortex runtime. Install with: cargo install cortex-runtime The daemon starts automatically on first use.

Quick Start

import cortex_client

# Map a website into a navigable graph
site = cortex_client.map("amazon.com")
print(f"Mapped {len(site.nodes)} pages, {len(site.edges)} links")

# Find products under $300
products = site.filter(page_type=0x04, features={48: {"lt": 300}}, limit=10)
for p in products:
    print(f"  {p.url}  price={p.features[48]}")

# Find the shortest path between two pages
path = site.pathfind(0, products[0].index)
print(f"Path: {' → '.join(str(n) for n in path.nodes)}")

Page Types

Use these codes with page_type= filters:

Code Type Description
0x01 Home Landing / home page
0x02 ProductListing Category or listing page
0x03 SearchResults Search results
0x04 ProductDetail Individual product page
0x05 Cart Shopping cart
0x06 Article Blog post or news article
0x07 Documentation Docs / help page
0x08 Login Authentication page
0x09 Checkout Checkout flow
0x0A Profile User profile
0x0B ApiEndpoint API endpoint
0x0C Media Video / audio page
0x0D Form General form page
0x0E Dashboard Dashboard / admin
0x0F Error Error page (404, 500)

Feature Dimensions

Each page has a 128-dimensional feature vector. Key dimensions:

Dim Name Example
48 Price (USD) features={48: {"lt": 300}}
49 Original price Sale detection
50 Discount 0.0 - 1.0
51 Availability 1.0 = in stock
52 Rating 0.0 - 5.0
53 Review count Absolute count
80 TLS (HTTPS) 1.0 = secure
96 Action count Available actions

API Reference

Map & Query

# Map a single site
site = cortex_client.map("github.com")

# Map multiple sites
sites = cortex_client.map_many(["amazon.com", "ebay.com"])

# Filter by type + features
products = site.filter(page_type=0x04, features={52: {"gt": 4.0}})

# Pathfind between pages
path = site.pathfind(from_node=0, to_node=42)

# Similarity search
similar = site.similar(node_index=5, limit=10)

Cross-Site Comparison

result = cortex_client.compare(["amazon.com", "ebay.com", "walmart.com"])
print(result.common_types)   # Shared page types
print(result.unique_types)   # Per-site unique types

Single Page Analysis

page = cortex_client.perceive("https://example.com/product/123")
print(page.page_type, page.features, page.actions)

Authentication

session = cortex_client.login("example.com", username="user", password="pass")
site = cortex_client.map("example.com", session=session)

Error Handling

from cortex_client import CortexConnectionError, CortexMapError, CortexTimeoutError

try:
    site = cortex_client.map("example.com")
except CortexConnectionError:
    print("Cortex daemon not running. Start with: cortex start")
except CortexTimeoutError:
    print("Mapping took too long. Try a smaller site or increase timeout.")
except CortexMapError as e:
    print(f"Mapping failed: {e}")

License

Apache-2.0

Metadata

Release files for cortex-agent 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cortex-agent 1.0.0
File Size Uploaded
cortex_agent-1.0.0.tar.gz 17.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cortex-agent 1.0.0
File Interpreter ABI Platform
cortex_agent-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.8 kB

Release files / cortex_agent-1.0.0.tar.gz

Download URL cortex_agent-1.0.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f323c485a9fd7f9bf95815a80f99e8ceff04e9923d543d8e4c794d2cc7a86e46
BLAKE2b-256 checksum
How to use checksums
abfd8a778e3bba2f62a1a8e52920788c8d394da67a1f36d707a3bd78a0eda3c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cortex_agent-1.0.0-py3-none-any.whl

Download URL cortex_agent-1.0.0-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea98e2d7f74ba481c034ba957b708cc996556275909f9dcab1cfda00133a69b2
BLAKE2b-256 checksum
How to use checksums
c04173ec732b0455507ea965ed0bfac983c6333d2444f6d5cb691ba8b0afb178
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page