Skip to main content

Overview

Acontext provides a REST API for building AI agents with persistent context.

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 session
session = client.sessions.create()

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

Core Concepts

Sessions represent conversation threads with message history.
Isolated storage groups for organizing files and artifacts 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