Skip to main content

Overview

Acontext provides a REST API for building AI agents with persistent context, semantic search, and self-learning capabilities.

REST API

RESTful endpoints with predictable URLs

OpenAPI 3.0

Full OpenAPI specification available

Multi-format Support

OpenAI, Anthropic, Gemini, and native formats

Client SDKs

Python and TypeScript libraries

Authentication

All API requests require a Bearer token in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Keep your API keys secure and never expose them in client-side code.

Install SDKs

pip install acontext

Quick Start

import os
from acontext import AcontextClient

# Initialize client
client = AcontextClient(
    api_key=os.getenv("ACONTEXT_API_KEY"),
)

# If you're using self-hosted Acontext:
# client = AcontextClient(
#     base_url="http://localhost:8029/api/v1",
#     api_key="sk-ac-your-root-api-bearer-token",
# )

# Create a knowledge space
space = client.spaces.create()

# Create a session connected to the space
session = client.sessions.create(space_id=space.id)

# Store a message
client.sessions.store_message(
    session.id,
    blob={'role': 'user', 'content': 'How do I reset my password?'}
)

# Search the knowledge base
results = client.spaces.experience_search(
    space.id,
    query='password reset process',
    mode='agentic'
)

Core Concepts

Knowledge spaces store structured information with semantic search capabilities. Each space can contain pages, folders, and content blocks.
Sessions represent conversation threads with message history. Connect sessions to spaces to leverage stored knowledge.
Building units of knowledge: pages, folders, text blocks, and SOPs. Blocks support rich properties and nested structures.
Isolated storage groups for organizing multiple knowledge bases within a project.
Capabilities that AI agents can use. Manage and configure tools across your project.

API Resources

Message Formats

Acontext supports multiple message formats for compatibility:
  • OpenAI - Compatible with OpenAI Chat Completion format (default)
  • Anthropic - Compatible with Anthropic Messages format
  • Gemini - Compatible with Google Gemini Messages format
Convert between formats when retrieving or storing messages using the format parameter.

Community