Docs
Quick Start

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
 
# Required for tool integrations
OPENAI_API_KEY=your-openai-api-key-here
EXA_API_KEY=your-exa-api-key-here

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 address
  • first_name and last_name: Replace with your name
from dotenv import load_dotenv
from lumnisai import AsyncClient, display_progress, ApiProvider, AgentConfig, Models
import os
import time
import asyncio
 
load_dotenv()
 
async def main():
    client = AsyncClient(
        api_key=os.getenv("LUMNISAI_API_KEY"), # Add API Key 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}.
    """
    
    # Configure agent behavior (optional)
    agent_config = AgentConfig(
        coordinator_model_name="openai:gpt-4.1",  # Model for coordinating tasks
        planner_model_name="openai:gpt-4.1",      # Model for planning steps
        orchestrator_model_name="openai:gpt-4.1", # Model for orchestrating execution
        use_cognitive_tools=True,                 # Enable advanced reasoning
        enable_task_validation=True,              # Validate task completion
        generate_comprehensive_output=False       # Control output verbosity
    )
    
    # Streaming response with agent configuration
    updates = []
    async for update in await client.invoke(task, stream=True, user_id=user_email, agent_config=agent_config):
        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:

  1. Client Initialization: Creates an async client with your API credentials
  2. API Key Management: Adds OpenAI and Exa API keys for tool integrations
  3. User Creation: Creates a new user in the Lumnis AI system
  4. Gmail Integration: Initiates a Gmail connection for sending emails
  5. Agent Configuration: Customizes agent behavior with specific models and settings:
    • Specifies which AI models to use for coordination, planning, and orchestration
    • Enables cognitive tools for advanced reasoning capabilities
    • Configures task validation and output preferences
  6. 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
  7. Real-time Streaming: Shows progress updates as the AI processes the task

Agent Configuration Options

The AgentConfig allows you to customize how your AI agent behaves. Here are the available options:

  • coordinator_model_name: The AI model used to coordinate between different components (e.g., "openai:gpt-4.1", "google_genai:gemini-2.5-pro")
  • planner_model_name: The AI model used to plan the steps needed to complete a task
  • orchestrator_model_name: The AI model used to orchestrate the execution of planned steps
  • use_cognitive_tools: Enable advanced reasoning and problem-solving capabilities (default: False)
  • enable_task_validation: Validate that tasks are completed successfully (default: False)
  • generate_comprehensive_output: Control the verbosity of the output (default: False)

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

Need Help?