AgentOps-AI / agentops

Python SDK for agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks like CrewAI, Langchain, and Autogen
https://agentops.ai
MIT License
1.16k stars 91 forks source link

Enhance Session Management and Functionality in llm_tracker.py and client.py #250

Open sarath59 opened 2 weeks ago

sarath59 commented 2 weeks ago

I have identified some opportunities to improve the session management and overall functionality in the llm_tracker.py, client.py, and session.py files. These changes aim to enhance the robustness and reliability of the AgentOps service.

Enhancements

  1. Improved Session Management Automatic Session Renewal: Automatically renew the session token if it's about to expire, ensuring seamless long-running sessions. Session State Tracking: Maintain session state to handle unexpected terminations gracefully. Session Expiration Handling: Added functionality to handle session expiration, automatically marking sessions as expired after inactivity.
  2. Enhanced Event Recording Detailed Error Handling: Improved error handling to capture more detailed information about failures, aiding in debugging and issue resolution. Async Event Recording: Added support for asynchronous event recording to handle high-throughput scenarios more efficiently.
  3. Session Metadata Management Custom Metadata: Allow for more detailed metadata to be attached to sessions, such as user information, environment details, or custom fields. Key Code Changes session.py Added session expiration handling. Included methods for session metadata management. Implemented session validation checks. client.py Enhanced _handle_unclean_exits to better manage unexpected terminations. Improved start_session and end_session methods to handle new session features. Updated session validation and expiration checks. llm_tracker.py Ensured session state and expiration are correctly managed during LLM tracking. Added detailed error logging for better debugging and tracking. These enhancements aim to provide a more robust and flexible session management system, improving the overall reliability of the AgentOps service.

I couldnt find any apt titles so i chose feature request. Apologies if its wrong type.

sarath59 commented 2 weeks ago

252 is being used for this purpose.