Skip to content

fix: restore @record_function decorator for backward compatibility#1411

Closed
icohangar-ops wants to merge 1 commit into
AgentOps-AI:mainfrom
icohangar-ops:fix/autogen-record-function
Closed

fix: restore @record_function decorator for backward compatibility#1411
icohangar-ops wants to merge 1 commit into
AgentOps-AI:mainfrom
icohangar-ops:fix/autogen-record-function

Conversation

@icohangar-ops

Copy link
Copy Markdown

Fixes #1076

Changes

  1. Restored @record_function decorator in agentops/legacy/__init__.py with a deprecation warning directing users to @task or @tool decorators.

  2. Exported from main packagerecord_function is now importable as from agentops import record_function, maintaining backward compatibility with existing user code.

Details

The @record_function decorator was removed during the v4.x migration without providing backward compatibility. This PR restores it:

  • Works with both sync and async functions
  • Creates a trace span using the v4 instrumentation system (SpanKind.INTERNAL, Task span kind)
  • Shows a deprecation warning: "Use @task or @tool decorator from agentops instead."
  • Can be used as @record_function() or @record_function(event_name="my_func")

Testing

  • Backward compatible — existing imports won't break
  • Integration test: from agentops import record_function works as expected

Adds the missing @record_function decorator to the legacy module with
a proper deprecation warning. The decorator creates a trace span using
the new v4 instrumentation system.

Fixes #1076
@icohangar-ops icohangar-ops closed this by deleting the head repository Jun 20, 2026
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.

Missing @record_function decorator and AutoGen instrumentation reliability issues in v0.4.14

2 participants