Quickstart
Install Acontext SDK and run a demo script
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.
Start Acontext server
Choose between hosted or self-hosted Acontext:
Go to Acontext Dashboard and sign up for a free account. The onboarding process will guide you to get an API key.
Set your API key as an environment variable:
export ACONTEXT_API_KEY="your-api-key"Refer to local deployment to start Acontext server in 2 commands. This launches:
- API: http://localhost:8029/api/v1
- Dashboard: http://localhost:3000/
The default API key is sk-ac-your-root-api-bearer-token.
Install the SDK
pip install acontextRequires Python 3.10 or newer.
npm install @acontext/acontextyarn add @acontext/acontextpnpm add @acontext/acontextRequires Node.js 16.x or newer.
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="[email protected]")
# 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)import { AcontextClient } from '@acontext/acontext';
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",
// });
async function main() {
console.log(await client.ping());
// Create a session (optionally associate with a user)
const session = await client.sessions.create({ user: '[email protected]' });
// Store messages
await client.sessions.storeMessage(session.id, {
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
`,
});
await client.sessions.storeMessage(session.id, {
role: 'user',
content: 'Confirm, go ahead. Use tailwind for frontend styling.',
});
// Retrieve messages
const messages = await client.sessions.getMessages(session.id);
console.log(messages.items);
}
main();If you see the success message and your stored messages, you're ready to start using Acontext!
Troubleshooting
Next Steps
Session Management
Create and manage sessions for organizing your conversations
Context Engineering
Build a compact context for agents in one API call
Disk Storage
Store and manage files and artifacts in Acontext
Skill Memory
Understand how skill memory works
API Reference
Explore the complete API documentation
Last updated on