Skip to main content
Get up and running with Acontext in under 5 minutes. This guide walks you through setting up the server, installing the SDK, and storing your first messages.
1

Start Acontext server

Choose between hosted or self-hosted Acontext:
2

Install the SDK

pip install acontext
Requires Python 3.10 or newer.
3

Verify your setup

Run this script to test your connection and store your first messages:
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())

# Create a session (optionally associate with a user)
session = client.sessions.create(user="user@example.com")

# Store messages
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.",
    },
)

# Retrieve messages
messages = client.sessions.get_messages(session_id=session.id)
print(messages.items)
If you see the success message and your stored messages, 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