-
Notifications
You must be signed in to change notification settings - Fork 510
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Contact Details
π¦ Package Version
0.4.7
ποΈ Framework Version
Anthroic 0.50.0
π Describe the Bug
Hi Team,
I was trying to run the example code provided in your docs-series repository. Below is the code I used:
from dotenv import load_dotenv
load_dotenv()
from anthropic import Anthropic
import os
import agentops
agentops.init(api_key=os.environ["AGENTOPS_API_KEY"], auto_start_session=False)
client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
scratch_folder = "scratch"
scratch_file = "response.md"
try:
agentops.start_session(tags=["anthropic-example"])
message = client.messages.create(
model="claude-3-5-sonnet-latest",
max_tokens=1024,
messages=[{
"role": "user",
"content": "What is the meaning of life?"
}]
)
os.makedirs(scratch_folder, exist_ok=True)
with open(os.path.join(scratch_folder, scratch_file), "w") as file:
file.write(message.content[0].text)
print(f"Response written to {scratch_folder}/{scratch_file}")
agentops.end_session("Success")
except Exception as e:
agentops.end_session("Fail", end_state_reason=str(e))
`
When I run the above code, I get the following error:
Traceback (most recent call last):
File "/agentops-py/anthropic-example/main.py", line 5, in <module>
import agentops
File "/agentops-py/anthropic-example/.venv/lib/python3.13/site-packages/agentops/logging/instrument_logging.py", line 7, in <module>
from agents import Span
ModuleNotFoundError: No module named 'agents'
Additional Information:
Python Version: 3.13
Environment: Virtual Environment (.venv)
agentops installed via pip
Followed the instructions mentioned in your repo.
Request: It seems like the agentops package is trying to import agents but itβs not available.
Could you please confirm if:
- I am missing any installation step?
- The version of agentops available on PyPI needs an update/fix?
- Or should I manually install any additional dependency?
π€ 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.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working