import asyncio
from nebula import AsyncNebula
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({
"collection_id": collection.id,
"content": "Async operations are fast",
"metadata": {"type": "example"}
})
results = await nebula.search(
query="async",
collection_ids=[collection.id]
)
for result in results:
print(f"{result.content}")
# Clean up
await nebula.aclose()
asyncio.run(main())