Skip to main content

axisdream

Official Python SDK for Axisdream — thin client for the Axisdream knowledge platform.

Published on PyPI as axisdream.

Install

pip install axisdream

Quickstart

import asyncio
import os
from axisdream import AsyncAxisdream

# Set these once in your environment, or pass them to AsyncAxisdream directly.
os.environ["AXISDREAM_API_KEY"] = "cs-YOUR_KEY"
os.environ["AXISDREAM_BASE_URL"] = "https://your-axisdream-api.example"

async def main():
    cog = AsyncAxisdream()
    space = await cog.space("my-agent")

    # Add knowledge
    await space.add(
        path="knowledge/retry.md",
        content="# Retry Patterns\nUse exponential backoff with jitter.",
        bucket="knowledge",
        topic="retry-patterns",
        confidence=0.95,
    )

    # Search first for substantive context. Axisdream coordinates all retrieval layers.
    results = await space.retrieve(
        "retry logic",
        top_k=10,         # final accepted context chunks (maximum 20)
        query_variants=[
            {"query": "retry logic with backoff failures", "kind": "rewrite"},
            {"query": "a passage describing reliable retry behavior with backoff and jitter", "kind": "hyde"},
            {"query": "retry backoff jitter", "kind": "exact"},
        ],
    )
    for item in results.results:
        print(f"{item.file_path}: {item.score:.2f} ({item.source})")

    # Retrieve a file
    file = await space.fetch("knowledge/retry.md")
    print(file.content)

    # Inspect structure only when a path or folder is specifically needed.
    files = await space.list("knowledge")
    print(f"Files: {files.file_count}")

    # Delete
    await space.forget("knowledge/retry.md")

    await cog.aclose()

asyncio.run(main())

Sync client

from axisdream import Axisdream

with Axisdream() as cog:
    space = cog.space("my-agent")
    results = space.retrieve(
        "retry logic",
        top_k=10,
        query_variants=[
            {"query": "retry logic with backoff failures", "kind": "rewrite"},
            {"query": "a passage describing reliable retry behavior with backoff and jitter", "kind": "hyde"},
            {"query": "retry backoff jitter", "kind": "exact"},
        ],
    )
    space.add(
        path="knowledge/retry.md",
        content="# Retry Patterns\n...",
        bucket="knowledge",
        topic="retry-patterns",
    )
    space.forget("knowledge/retry.md")

API Reference

Axisdream(api_key, base_url, timeout, max_retries)

Reads AXISDREAM_API_KEY from environment if api_key is not provided. Reads AXISDREAM_BASE_URL if base_url is not provided, then falls back to http://localhost:8000 for local development.

Method Description
cog.space(name_or_id) Get a space client by name or ID
cog.list_spaces() List all your spaces

SpaceClient

Method Args Description
space.list(folder) folder="" List files in folder
space.fetch(path) path Get one file with content + metadata
space.retrieve(query, ...) see below Ranked context discovery across semantic, lexical, and relationship signals
space.add(path, content, bucket, topic, confidence, file_type, status, related, relates_to) see below Add/update knowledge
space.forget(path) path Delete from all layers
space.get_tools() — Fetch the Platform's live MCP-compatible tool schemas

add() parameters

Param Type Required Description
path str yes File path (e.g. "knowledge/retry.md")
content str yes Markdown content
bucket str yes "knowledge", "memory", "skills", or "state"
topic str yes Category/topic
confidence float no 0.0-1.0, default 0.9
file_type str no Explicit file type override
status str no Metadata status, default active
related list[str] no Canonical related file paths
relates_to list[str] no Backward-compatible alias for related

Buckets

Bucket Use for
knowledge Knowledge, patterns, guides, reference material
memory Agent memory, user preferences, session notes
skills Reusable procedures, workflows, and operator playbooks
state Current mission and compact working state such as state/mission.md and state/memory.md

Search limits

retrieve() parameters (enforced at backend). The backend automatically coordinates the available retrieval sources; these values adjust candidate coverage rather than selecting an engine:

Param Type Default Range Description
top_k int 10 1–20 Final accepted context chunks. Retrieval layers are coordinated automatically.
bucket str None "knowledge"/"memory"/"skills"/"state" Filter by bucket.
folder_path str None — Restrict to folder.
query_variants list required Exactly 3 One agent-generated {query, kind} probe for each of rewrite, exact, and hyde; the top-level query is raw.

Examples:

# Adjust coverage while keeping the backend retrieval pipeline automatic
results = await space.retrieve("query", top_k=10)

# Multi-aspect retrieval: one call, bounded and deduplicated by Axisdream
results = await space.retrieve(
    "design the onboarding modal",
    query_variants=[
        {"query": "modal composition and hierarchy", "kind": "rewrite"},
        {"query": "accessible onboarding dialog behavior", "kind": "exact"},
    ],
    top_k=10,
)

Errors

from axisdream.exceptions import AuthError, NotFoundError, RateLimitError

try:
    results = await space.retrieve("query")
except AuthError:
    print("Invalid API key")
except NotFoundError:
    print("Space not found")
except RateLimitError:
    print("Rate limited, retry later")

Local-first note

The Python SDK uses the configured hosted URL when available:

  • Base URL precedence: base_url, then AXISDREAM_BASE_URL, then http://localhost:8000
  • Space lookup accepts either a space name or a space ID

Metadata

Release files for axisdream 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 axisdream 1.0.0
File Size Uploaded
axisdream-1.0.0.tar.gz 12.6 kB Details

Built distribution (wheel)

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

Total release size: 27.8 kB

Release files / axisdream-1.0.0.tar.gz

Download URL axisdream-1.0.0.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
df0c2113b941137d236eb2c87eacb2fbb3ffbcff34b73f038a5c4bb8fe90afaf
BLAKE2b-256 checksum
How to use checksums
13ba76e5d8819b28ed095bfb968e57970189825fa8d15f5dbd70386e0aa0e2dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

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

Download URL axisdream-1.0.0-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
79cd6ef2ba064543a737a3921915430f05cc4d3e34f3e1465318f0a28c6287d4
BLAKE2b-256 checksum
How to use checksums
08295d77dd6c3863a57cbab4cf7a9ea9e706b8c25af113f3c85b082e59716d9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

1.0.2

2 release files

This release

1.0.0 This release

2 release files

0.6.6

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

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