Acontext

Introduction

Build AI agents with skill memory

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
npm install @acontext/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?'}
)
import { AcontextClient } from '@acontext/acontext';

// Initialize client
const client = new AcontextClient({
    apiKey: process.env.ACONTEXT_API_KEY,
});

// If you're using self-hosted Acontext:
// const client = new AcontextClient({
//     baseUrl: "http://localhost:8029/api/v1",
//     apiKey: "sk-ac-your-root-api-bearer-token",
// });

// Create a session
const session = await client.sessions.create();

// Store a message
await client.sessions.storeMessage(
  session.id,
  { role: 'user', content: 'How do I reset my password?' }
);

Core Concepts

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

Last updated on

On this page