Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions agentops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
end_session,
track_agent,
track_tool,
record_function,
end_all_sessions,
Session,
ToolEvent,
Expand Down Expand Up @@ -260,6 +261,7 @@ def end_trace(
"configure",
"get_client",
"record",
"record_function",
"start_trace",
"end_trace",
"start_session",
Expand Down
3 changes: 2 additions & 1 deletion agentops/instrumentation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class InstrumentorConfig(TypedDict):
"class_name": "CrewAIInstrumentor",
"min_version": "0.56.0",
},
"autogen": {"module_name": "agentops.instrumentation.ag2", "class_name": "AG2Instrumentor", "min_version": "0.1.0"},
"autogen": {"module_name": "agentops.instrumentation.ag2", "class_name": "AG2Instrumentor", "min_version": "0.3.2"},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might be sus. why two definitions of the module version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. AutoGen does not have an instrumentation in our codebase and uses its telemetry instead.

"ag2": {"module_name": "agentops.instrumentation.ag2", "class_name": "AG2Instrumentor", "min_version": "0.1.0"},
"agents": {
"module_name": "agentops.instrumentation.openai_agents",
"class_name": "OpenAIAgentsInstrumentor",
Expand Down
12 changes: 12 additions & 0 deletions agentops/legacy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,17 @@
return noop


@deprecated("Use @tool decorator instead.")
def record_function(*args: Any, **kwargs: Any) -> Any:
"""@deprecated Use @tool decorator instead. Wraps the @tool decorator for backward compatibility."""
from agentops.sdk.decorators import tool

Check warning on line 269 in agentops/legacy/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/legacy/__init__.py#L269

Added line #L269 was not covered by tests

if not args or not callable(args[0]):
return tool(*args, **kwargs)

Check warning on line 272 in agentops/legacy/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/legacy/__init__.py#L271-L272

Added lines #L271 - L272 were not covered by tests
else:
return tool(args[0], **kwargs)

Check warning on line 274 in agentops/legacy/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/legacy/__init__.py#L274

Added line #L274 was not covered by tests


__all__ = [
"start_session",
"end_session",
Expand All @@ -271,6 +282,7 @@
"ActionEvent",
"track_agent",
"track_tool",
"record_function",
"end_all_sessions",
"Session",
"LLMEvent",
Expand Down
8 changes: 7 additions & 1 deletion examples/ag2/agentchat_with_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@
from dotenv import load_dotenv
import agentops
from mem0 import MemoryClient
from autogen import ConversableAgent
try:
from autogen import ConversableAgent
except ImportError:
try:
from ag2 import ConversableAgent
except ImportError:
raise ImportError("Neither 'autogen' nor 'ag2' package found. Please install one of them.")

load_dotenv()
os.environ["AGENTOPS_API_KEY"] = os.getenv("AGENTOPS_API_KEY", "your_api_key_here")
Expand Down
Loading