Quick Start
Get up and running with Lumnis AI in 5 minutes
Quick Start Guide
This guide will help you create your first AI-powered application with Lumnis AI in just 5 minutes.
Prerequisites
Before you begin, make sure you have:
- Python 3.8 or higher installed
- A Lumnis AI account (coming soon!)
- Your API key ready
Step 1: Install the SDK
Open your terminal and install the Lumnis AI Python SDK:
pip install lumnisai
Step 2: Set Up Your Environment Variables
Create a .env
file in your project directory with the following environment variables:
# Required
LUMNISAI_API_KEY=your-lumnis-api-key-here
LUMNISAI_BASE_URL=https://api.lumnis.ai
# Required for tool integrations
OPENAI_API_KEY=your-openai-api-key-here
EXA_API_KEY=your-exa-api-key-here
Security Tip: Never commit your API keys to version control. Add .env
to your .gitignore
file.
Step 3: Create Your First AI Application
Create a new file called hello_lumnis.py
and make sure to update the following values with your information:
user_email
: Replace with your actual email addressfirst_name
andlast_name
: Replace with your name
from dotenv import load_dotenv
from lumnisai import AsyncClient, display_progress, ApiProvider
import os
import time
import asyncio
load_dotenv()
async def main():
client = AsyncClient(
api_key=os.getenv("LUMNISAI_API_KEY"), # Add API Key Here
base_url=os.getenv("LUMNISAI_BASE_URL"), # Add Base URL Here
)
# Add API keys
await client.add_api_key(ApiProvider.OPENAI_API_KEY, os.getenv("OPENAI_API_KEY"))
await client.add_api_key(ApiProvider.EXA_API_KEY, os.getenv("EXA_API_KEY"))
user_email = "example@gmail.com"
user = await client.create_user(email=user_email, first_name="Example", last_name="User")
connection = await client.initiate_connection(user_id=user_email, app_name="GMAIL")
print("Connection initiated. Click the link to authorize the connection: ", connection)
# Wait until the connection is active
status = await client.wait_for_connection(user_id=user_email, app_name="GMAIL")
print(status)
task = f"""
What are the latest trends in AI agents and machine learning?
What are agentic models?
What are the latest papers on agentic models and agentic AI?.
Send email to {user_email}.
"""
# Streaming response
updates = []
async for update in await client.invoke(task, stream=True, user_id=user_email):
display_progress(update)
updates.append(update)
print(update.output_text)
# Run the async function
asyncio.run(main())
What This Example Does
This quick start example demonstrates the key features of Lumnis AI:
- Client Initialization: Creates an async client with your API credentials
- API Key Management: Adds OpenAI and Exa API keys for tool integrations
- User Creation: Creates a new user in the Lumnis AI system
- Gmail Integration: Initiates a Gmail connection for sending emails
- AI Task Processing: Sends a complex research task that:
- Researches the latest trends in AI agents and machine learning
- Explores agentic models and recent papers
- Composes and sends an email with the findings
- Real-time Streaming: Shows progress updates as the AI processes the task
Step 4: Run Your Application
Execute your script:
python hello_lumnis.py
Your AI assistant will process the task and send an email with the research findings.
What's Next?
Congratulations! You've just built your first AI application with Lumnis AI.
Learn More
- Python SDK Documentation - Complete API reference
- REST API Reference - Use Lumnis AI with any programming language
- GitHub Examples - Full application examples
Need Help?
- 📧 Email support@lumnis.ai for technical support
- 🐛 Report issues on GitHub