A quick demo showing how to use the antonlytics Python SDK to give any AI model long-term, queryable memory backed by a knowledge graph.
- Ingest natural language — the agent extracts entities and relationships automatically.
- Chat — ask questions; the agent retrieves relevant context and responds.
- Get memory — pull raw graph data to inject into your own model.
pip install antonlytics django-environCreate a .env file in the project root:
ANTONLYTICS_API=your_api_key_here
ANTONLYTICS_PROJECT=your_project_id_hereOpen notebook.ipynb and run all cells.
from antonlytics import Agent
import environ
env = environ.Env()
environ.Env.read_env(".env")
agent = Agent(
api_key=env("ANTONLYTICS_API"),
project_id=env("ANTONLYTICS_PROJECT")
)
# Teach the agent something
agent.ingest("""
Customer Alice from USA purchased Laptop Pro for $999.
She's interested in our Enterprise plan.
""")
# Set a system prompt
agent.set_system_prompt(
"You are a helpful assistant to the store's owner. "
"Respond directly and efficiently."
)
# Ask a question — the agent uses its memory
response = agent.chat("Who purchased laptops?")
print(response["response"])
# => "Alice from USA purchased a Laptop Pro for $999"
# Or pull raw memory for use with your own model
memory = agent.get_memory("laptop purchases")
print(memory){
"entities": [
{ "type": "Person", "properties": { "name": "Alice", "country": "USA" } },
{ "type": "Product", "properties": { "name": "Laptop Pro", "price": "$999" } },
{ "type": "Product", "properties": { "name": "Enterprise plan" } }
],
"relationships": [
{ "type": "PURCHASED", "source": "Alice", "target": "Laptop Pro" },
{ "type": "INTERESTED_IN", "source": "Alice", "target": "Enterprise plan" }
]
}- Ingest parses free-form text into graph nodes (entities) and edges (relationships).
- Chat retrieves the most relevant subgraph and passes it as context to the underlying model.
- Get memory exposes the raw graph so you can use it with any AI model of your choice.