import asyncio
from nebula import AsyncNebula, Memory
async def main():
# Create async client (uses NEBULA_API_KEY env var)
nebula = AsyncNebula()
# All operations are async
collection = await nebula.create_collection(name="async_notes", description="Async example")
memory_id = await nebula.store_memory(
Memory(
collection_id=collection.id,
content="Async operations are fast",
metadata={"type": "example"}
)
)
results = await nebula.search(
query="async",
collection_ids=[collection.id]
)
for fact in results.semantics:
print(fact)
# Clean up
await nebula.aclose()
asyncio.run(main())