Get complete AI observability with just 2 lines of code
Note: Setup has two parts — (1) connecting it to the Lucidic Dashboard, and (2) installing LucidicAI in your code (below).
import lucidicai as lai lai.init(providers=["openai"]) # That's it!
pip install lucidicai
export LUCIDIC_API_KEY=your-api-key export LUCIDIC_AGENT_ID=your-agent-id
import lucidicai as lai from openai import OpenAI # Just these 2 lines to add complete observability: lai.init(providers=["openai"]) # Your existing code remains unchanged client = OpenAI() def analyze_text(text): response = client.chat.completions.create( model="gpt-4", messages=[{"role": "user", "content": f"Analyze this: {text}"}] ) return response.choices[0].message.content def summarize_text(text): response = client.chat.completions.create( model="gpt-4", messages=[{"role": "user", "content": f"Summarize this: {text}"}] ) return response.choices[0].message.content # Your workflow runs normally text = "The quick brown fox jumps over the lazy dog." analysis = analyze_text(text) summary = summarize_text(analysis) print(summary) # When script exits, Lucidic automatically: # 1. Creates steps for each distinct operation # 2. Creates events for each LLM call # 3. Ends all steps properly # 4. Ends the session # 5. Sends everything to your dashboard
init()
# OpenAI lai.init(providers=["openai"]) # Anthropic lai.init(providers=["anthropic"]) # Multiple providers lai.init(providers=["openai", "anthropic"]) # Other supported providers lai.init(providers=["langchain"]) # LangChain lai.init(providers=["pydantic_ai"]) # PydanticAI lai.init(providers=["openai_agents"]) # OpenAI Agents