Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added is_auto_end flag in agentops.end session in crew.py #1320

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

anmol-aidora
Copy link
Contributor

When using agentops, we have the option to pass the skip_auto_end_session parameter, which is supposed to not end the session if the end_session function is called by Crew.

Now the way it works is, the agentops.end_session accepts is_auto_end flag and crewai should have passed it as True (its False by default).

I have changed the code to pass is_auto_end=True

When using agentops, we have the option to pass the `skip_auto_end_session` parameter, which is supposed to not end the session if the `end_session` function is called by Crew.

Now the way it works is, the `agentops.end_session` accepts `is_auto_end` flag and crewai should have passed it as `True` (its `False` by default). 

I have changed the code to pass is_auto_end=True
@anmol-aidora
Copy link
Contributor Author

anmol-aidora commented Sep 13, 2024

I ran poetry run pytest, it requires OPENAI_API_KEY, and is causing these errors. The changes I have made aren't causing error.

Is OPENAI_API_KEY not set in the checks?

Also, is there any estimate of how many tokens the tests consume?

@bhancockio
Copy link
Collaborator

Hey @anmol-aidora !

Could you please elaborate more on is_auto_end? I'm not fully understanding what's going wrong and how changing is_auto_end to True fixes the issue.

If you could share any examples showing this fix working and solving the issue, that would be great!

@anmol-aidora
Copy link
Contributor Author

Hey @anmol-aidora !

Could you please elaborate more on is_auto_end? I'm not fully understanding what's going wrong and how changing is_auto_end to True fixes the issue.

If you could share any examples showing this fix working and solving the issue, that would be great!

Hi @bhancockio

I am attaching screenshot to the code in agentops for the agentops.end_session function:
image
Here is the link to the code: https:/AgentOps-AI/agentops/blob/d04622ac4f91ec024ec76e1eb047b7846d744be1/agentops/client.py#L272

It ensures that the session does not end if the skip_auto_end_session value is set to True in agentops config.

As we are doing automatic use of the end_session function in our code, we should set it to True.

@anmol-aidora
Copy link
Contributor Author

I have prepared before/after code change scenario files. Please check them out:
crewai_before_bug_fix.pdf
crewai_after_bug_fix.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants