Python
Install the Python SDK and start building AI applications with semantic memory.
Build AI applications with Python using the Graphlit SDK.
Installation
Install the Graphlit client with pip:
pip install graphlit-clientRequirements:
Python 3.8 or higher
Graphlit account with API credentials
Quick Start
import asyncio
import os
from graphlit import Graphlit
from graphlit_api import *
async def main():
# Reads from environment variables automatically
graphlit = Graphlit()
# Ingest content
response = await graphlit.client.ingest_text(
name="Product Requirements",
text="Our AI agent needs persistent memory across sessions..."
)
print(f"✅ Memory created: {response.ingest_text.id}")
asyncio.run(main())That's it! The SDK automatically reads GRAPHLIT_ORGANIZATION_ID, GRAPHLIT_ENVIRONMENT_ID, and GRAPHLIT_JWT_SECRET from your environment.
Configuration
Environment Variables (Production)
Create a .env file (never commit this):
Load it with python-dotenv:
Install python-dotenv:
Security: Add .env to your .gitignore immediately. Use platform secrets (AWS Secrets Manager, etc.) in production deployments.
Alternative: Explicit Configuration
Only use if you need to override environment variables:
Common Patterns
Ingest Content
Search Memory
Chat with Context
Next Steps
Quickstarts:
Quickstart: Your First Agent - Build a streaming agent in 7 minutes
AI Agents - Create agents with persistent memory
Knowledge Graph - Extract entities and relationships
Examples:
Python Notebooks - 60+ working examples
Streamlit Apps - Full UI applications
Resources:
Use Case Library - 100+ code examples
Ask Graphlit - AI code assistant
Join Discord - Get help from the community
Last updated
Was this helpful?