Skip to main content

Start Acontext Server

Use Hosted Acontext

Go to Acontext Dashboard and sign up for a free account. The onboarding process will guide you to get an API key.

Use Self-hosted Acontext

Refer to this doc to start acontext server in 2 commands. It will launch Acontext API and Dashboard on your local machine: The default API key is sk-ac-your-root-api-bearer-token.

Install SDK

Acontext provides official SDKs for Python and TypeScript/JavaScript, making it easy to integrate Acontext into your applications. The SDKs handle authentication, request formatting, and provide type-safe interfaces to all Acontext features.

Requirements

  • Python 3.10 or newer
  • pip (Python package installer)

Install via pip

pip install acontext

Quick Start

After installation, verify your setup with a quick connection test:
import os
from acontext import AcontextClient

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",
# )

print(client.ping())

session = client.sessions.create()
client.sessions.store_message(
    session_id=session.id,
    blob={
        "role": "assistant",
        "content": """Here is my plan:
1. Use Next.js for the frontend
2. Use Supabase for the database
3. deploy to Cloudflare Pages
""",
    },
)
client.sessions.store_message(
    session_id=session.id,
    blob={
        "role": "user",
        "content": "Confirm, go ahead. Use tailwind for frontend styling.",
    },
)


messages = client.sessions.get_messages(session_id=session.id)
print(messages.items)
If you see the success message, you’re ready to start using Acontext!

Troubleshooting

  • Verify your Acontext server is running
  • Check that the base_url is correct
  • Ensure no firewall is blocking the connection
  • For local development, confirm you’re using http://localhost:8029/api/v1
  • Verify your API key is correct
  • Check that the API key has the necessary permissions
  • Ensure you’re passing the API key in the correct format
  • Confirm the package is installed: pip list | grep acontext (Python) or npm list @acontext/acontext (TypeScript)
  • Try reinstalling the package
  • Check your Python version is 3.10+ or Node.js version is 16+
  • Ensure you’re using TypeScript 4.5 or newer
  • Run npm install to ensure all type definitions are installed
  • Check that your tsconfig.json has proper settings for module resolution

Next Steps