agentops
agentops copied to clipboard
[Bug]: Can't run Agentops in .ipynb whereas the same code works in a .py file.
Contact Details
📦 Package Version
0.4.4
🎞️ Framework Version
CrewAI : 0.100.0
🔎 Describe the Bug
I am running the code :
`import agentops from crewai import Agent, Crew, Process, Task,LLM import openai from openai import OpenAI import os from langchain_openai import ChatOpenAI from dotenv import load_dotenv from agentops import track_tool load_dotenv()
agentops.init(api_key=os.getenv("AGENTOPS_API_KEY"),default_tags=['crewai'],auto_start_session=True) OPENAI_API_KEY=os.getenv("OPENAI_API_KEY") llm=LLM(api_key=OPENAI_API_KEY,model='gpt-4o')
Create specialized agents
researcher = Agent( role="Market Research Specialist", goal="Find comprehensive market data on emerging technologies", backstory="You are an expert at discovering market trends and gathering data.", llm=llm )
analyst = Agent( role="Market Analyst", goal="Analyze market data and identify key opportunities", backstory="You excel at interpreting market data and spotting valuable insights.", llm=llm )
Define their tasks
research_task = Task( description="Research the current market landscape for AI-powered healthcare solutions", expected_output="Comprehensive market data including key players, market size, and growth trends", agent=researcher )
analysis_task = Task( description="Analyze the market data and identify the top 3 investment opportunities", expected_output="Analysis report with 3 recommended investment opportunities and rationale", agent=analyst, context=[research_task] )
Create the crew
market_analysis_crew = Crew( agents=[researcher, analyst], tasks=[research_task, analysis_task], process=Process.sequential, verbose=True )
Run the crew
result = market_analysis_crew.kickoff() print(result.raw) `
When I run this in .py file it works I can see everything but I want to use this in my notebook itself. Agentops is not initializing in notebook , why is this happening and how to resolve?
🤝 Contribution
- [ ] Yes, I'd be happy to submit a pull request with these changes.
- [ ] I need some guidance on how to contribute.
- [ ] I'd prefer the AgentOps team to handle this update.
Crew version 0.100 is kinda buggy, can you try upgrading that and try again? @Niharrrrrr
Yes I upgraded to 0.108 the latest of crew still doesn't work
I'm having difficulties replicating the issue @Niharrrrrr
Here's my notebook run:
.py file run:
<img width="521" alt="Image" src="https://github.com/user-attachments/assets/6ac950b3-8ee1-4a43-8f8c-e645fa5e730f" />
Can you show me all the initial cells onto how you did it. It would be extremely helpful. I would like to use this tool into my production code and would be grateful if you helped me solve this issue. Also is there any video/tutorial which uses agentops in a .ipynb file. I couldn't find it.
Check this out @Niharrrrrr ? https://gist.github.com/areibman/922907d11ee3bbcf40f6aa746bcfa19e
yes I figured the bug. thanks. Also why can't I see any LLM logs , is there something I am missing? Decorator or something? It should monitor the llm in crewai or is that for when we hit simple openai api?
yes I figured the bug. thanks. Also why can't I see any LLM logs , is there something I am missing? Decorator or something? It should monitor the llm in crewai or is that for when we hit simple openai api?
Mind sharing a trace ID given in terminal? I was able to see on my end, but we're doing some fixes in the frontend-- chances are you're hitting one of those issues.
ID: 474dcbe96d7dcae66d4b33d56cf353dc , I am unable to see on the frontend the LLM Logs tab , by looking in deep the traces I can see the green llm calls but shouldn't I be able to see those seperately on LLM Logs?
hi @Niharrrrrr! we've come a very long way in the last two weeks with bug fixes. I couldnt trace down the exact cause of this, but it'd be great if you would try again and see if the issue is still persisting. please be sure to upgrade agentops too!
pip install -U agentops
closed - stale