Notes
This release of the Python agent adds support for AI Monitoring server-side configuration, adds context propagation for Bedrock invocations made through Microsoft Agent Framework, fixes duplicate tool entities for LangChain tools backed by a remote MCP server, reduces race condition risk in the garbage collection data sampler, fixes inconsistent transaction names when using Wagtail, and removes byte encoding from outbound Kombu distributed tracing headers.
Install the agent using easy_install/pip/distribute via the Python Package Index, using conda via the Conda-Forge Package Index, or download it directly from the New Relic download site.
New Features
Add support for AI Monitoring server-side configuration
- The Python agent now supports server-side configuration of AI Monitoring. When configured, the server-side
ai_monitoring.enabled,ai_monitoring.record_content.enabled, andai_monitoring.streaming.enabledvalues take precedence over the local settings.
- The Python agent now supports server-side configuration of AI Monitoring. When configured, the server-side
Add context propagation for Bedrock invocations through Agent Framework
- Propagates trace context across thread boundaries created by Microsoft Agent Framework's Bedrock integration. This allows the agent's existing botocore instrumentation to capture LLM events for Bedrock invocations made through Agent Framework. This does not add full instrumentation of Agent Framework itself.
Bugs
Fix inconsistent transaction names when using Wagtail
- Previously, transaction names for apps built on Wagtail were inconsistent and could be the same for different page views. This has been fixed.
Fix duplicate tool entities for LangChain tools backed by a remote MCP server
- Previously, when a LangChain tool was backed by a remote MCP server that was also separately instrumented, duplicate tool entities appeared in the UI. This has been fixed by gating subcomponent attributes off of LangChain tools when a known remote tool is detected.
Fix missing User Input field for LangChain and LangGraph MCP tool calls
- Previously, when LangChain or LangGraph used tools from an MCP server, the User Input field could be missing from AI monitoring data if the input message wasn't the last message in the streamed sequence. This has been fixed, and the agent now correctly extracts the input message in these cases.
Reduce race condition risk in the garbage collection data sampler
- Previously, the agent always called
gc.get_objects()to sample garbage collector object counts, regardless of configuration. This has been changed sogc.get_objects()is only called whentop_object_count_limitis configured above0, avoiding unnecessary heap iteration for customers who don't track object types collected by the garbage collector.
- Previously, the agent always called
Remove byte encoding from outbound Kombu distributed tracing headers
- Previously, distributed tracing headers added by Kombu instrumentation were byte-encoded, which broke transports that serialize payloads with the standard library
jsonmodule (for example, SQLAlchemy-backed transports). The byte encoding has been removed so these transports work correctly.
- Previously, distributed tracing headers added by Kombu instrumentation were byte-encoded, which broke transports that serialize payloads with the standard library
Support statement
We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read more about keeping agents up to date.
See the New Relic Python agent EOL policy for information about agent releases and support dates.
メモ
Pythonエージェントのこのリリースでは、Google ADKの計装サポートを追加し、複数のAIプロバイダー(Anthropic、Google生成AI、OpenAI、およびAWS Bedrock)のトークンカウントを追加し、アウトバウンドのtracestateヘッダーサイズを縮小し、graphql-core計装のクラッシュを修正しました。
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用するか、 Conda-Forge パッケージ インデックス経由でcondaを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
改善された機能
Google ADKの計装を追加
Pythonエージェントは、Google ADK(Agent Development Kit)AIエージェントのワークフローを計装するようになりました。
インストゥルメントされたコンポーネントとしては、次のものがあります:
LlmAgentgoogle.genai経由でGeminiまたはVertexAIバックエンドにリンクされています- ユーザー定義の
FunctionToolインスタンス - 子エージェントおよび
AgentToolインスタンスを含むサブエージェントのワークフロー Workflowクラス、および非推奨のLoopAgent、ParallelAgent、SequentialAgentクラスを含むマルチエージェントワークフロー
Anthropic、Gemini、OpenAI、およびBedrockのトークンカウントを追加
Pythonエージェントは、複数のAIプロバイダーにわたるすべてのLLM呼び出しのトークンカウントを報告するようになりました:
- Anthropic SDK
- Google生成AI SDK
- OpenAI SDK
- botocoreおよびaiobotocore経由のAWS Bedrock
バグ
graphql-core v3.2.10 の計装のクラッシュを修正しました
- 以前は、graphql-core v3.2.10で
ExecutionContextのerrors属性がcollected_errorsに名前変更されたため、エージェントがクラッシュしていました。この問題は修正され、エージェントはgraphql-core v3.2.10以降で正常に動作するようになりました。
- 以前は、graphql-core v3.2.10で
アウトバウンドの
tracestateヘッダーからspanIdを削除- 以前は、エージェントはアウトバウンドの
tracestateヘッダーにspanIdを含めていました。spanIdはすでにtraceparentヘッダーに存在するため、これは不要な重複でした。アウトバウンドのヘッダーサイズを縮小するため、spanIdはtracestateから削除されました。
- 以前は、エージェントはアウトバウンドの
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
メモ
Pythonエージェントのこのリリースでは、LangChainチェーンLLMイベントに追加のモデル情報を追加し、LangGraphストリーミング計装のバグを修正しました。
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用するか、 Conda-Forge パッケージ インデックス経由でcondaを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
改善された機能
LangChain チェーン LLM イベントに追加のモデル情報を追加する
- LangChainチェーンによって生成されたLLMイベントに
request.modelおよびresponse.model属性を追加します。 - この情報はベストエフォートで取得されるため、常に利用可能であるとは限りません。
- LangChainチェーンによって生成されたLLMイベントに
バグ
LangGraphストリーミング計装におけるTypeErrorを修正
- 以前は、LangGraphでストリーミングAPIのサブセットを使用する際、LangGraphによる
weakref.WeakMethodの使用が原因で、エージェントでTypeErrorが発生していました。この問題は修正され、エージェントはそれらのLangGraphストリーミングメソッドで正しく動作するはずです。
- 以前は、LangGraphでストリーミングAPIのサブセットを使用する際、LangGraphによる
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
メモ
Pythonエージェントの今回のリリースでは、複数の新しいRedisコマンドのサポートを追加し、LangGraph計装のバグを修正し、ハーベスト制限設定の処理とロギングを改善しています。
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用するか、 Conda-Forge パッケージ インデックス経由でcondaを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
改善された機能
新しいRedis v8.8.0コマンドの計装を追加
redis-py v8.8.0 の 以下の新しいRedisコマンド の計装を追加:
- その他のコマンド:INCREX、XNACK
- 配列コマンド:ARCOUNT、ARDEL、ARDELRANGE、ARGET、ARGETRANGE、ARGREP、ARINFO、ARINSERT、ARLASTITEMS、ARLEN、ARMGET、ARMSET、ARNEXT、AROP、ARRING、ARSCAN、ARSEEK、ARSET
バグ
LangGraph計装でのクラッシュを修正
- 以前は、LangGraphの計装を使用すると、AsyncBackgroundExecutor内のジョブへのコンテキスト伝搬の問題により、エージェントがクラッシュしていました。この問題は修正され、エージェントはLangGraphで正常に動作するはずです。
ハーベスト制限設定の処理とロギングを改善
- エージェントは、New Relic OneのEnvironmentタブにハーベストメソッドと制限のリストをより正確に報告するようになりました。
- エージェントの起動時におけるハーベスト制限設定のデバッグログが、より一貫性を持つようになりました。
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
メモ
Pythonエージェントのこのリリースでは、LangChainおよびLangGraphにおけるコンテキスト伝搬の問題、OpenAIのチャット補完の記録に関する問題、およびLiteLLMをプロキシとして介してOpenAI(https://pypi.org/project/openai)ストリーミングを使用する際の問題が修正されています。
Python パッケージ インデックス経由でeasy_install/pip/distributeを使用するか、 Conda-Forge パッケージ インデックス経由でcondaを使用してエージェントをインストールするか、 New Relic ダウンロード サイトから直接ダウンロードします。
バグ
LangChainおよびLangGraphにおけるコンテキスト伝搬を修正
OpenAIチャットコンプリーションの記録に関する問題を修正
- OpenAI は、消費者がすべてのデータを読み取っていなくてもストリーミングレスポンスを閉じるロジックを再導入しました。以前は、チャットコンプリーションデータはストリームの終端に達したときにのみ記録されていたため、ストリームのクローズ時にチャットコンプリーションデータが記録されない結果となっていました。ストリームが完全に読み取られていない場合でも、チャット完了データをキャプチャするロジックが追加されました。
プロキシとしてLiteLLMを経由してOpenAIストリーミングを使用する際の問題を修正
サポートステートメント
最新のエージェント バージョンが利用可能になったらすぐに更新することをお勧めします。最新バージョンにアップグレードできない場合は、エージェントを 90 日以内のバージョンに更新してください。エージェントを最新の状態に保つ方法の詳細については、こちらをご覧ください。
エージェントのリリースとサポート日については、New Relic Python エージェントのEOL ポリシーを参照してください。
Notes
This release of the Python agent removes support for Python lambda function in the config file, excludes the newrelic header by default, adds support for exclude and include settings for Hybrid Agent traces, anthropic instrumentation, gemini response streaming, improves caching of IS_PYPY in gc_data.py for performance, and adds http.statusCode attribute in transaction events. This release also resends modules during reconnect ensuring they are recorded, guards garbage collection metrics against re-entrant calls, fixes task propagation in async generators and starlette context propagation in StreamingResponse.
Install the agent using easy_install/pip/distribute via the Python Package Index, using conda via the Conda-Forge Package Index, or download it directly from the New Relic download site.
Removed features
Remove support for Python lambda functions in the config file
- Previously, the agent allowed specifying a Python lambda function to dynamically name transactions, background task, database trace, profile trace, external trace url and method, function trace, generator trace, and memcache trace. Since support for this feature exposes a security vulnerability in the agent this feature is being removed.
Deprecations
- The
response.statusattribute inWebTransactions is considered deprecated and will be removed in the upcoming 14.0.0 release. It is being replaced byhttp.statusCode. We recommend replacing all references toresponse.statuswithhttp.statusCode.
New features
Exclude the
newrelicheader by default- The
newrelicdistributed tracing header is now no longer sent by default. Only the W3Ctraceparentandtracestateheaders will be sent.
- The
Add exclude and include settings for Hybrid Agent traces
opentelemetry.traces.includefor the configuration file orNEW_RELIC_OPENTELEMETRY_TRACES_INCLUDEto be used as an environment variableopentelemetry.traces.excludefor the configuration file orNEW_RELIC_OPENTELEMETRY_TRACES_EXCLUDEto be used as an environment variable
The Hybrid Agent's default behavior will be different as well. Now, only libraries and tracers that are supported by OpenTelemetry but not already supported by New Relic will utilize OpenTelemetry's instrumentation. Otherwise, the agent will default to the New Relic instrumentation hooks.
More information about these settings can be found in the Python Agent configuration page as well as the OpenTelemetry API support page.
Add Anthropic streaming instrumentation
- Adds instrumentation support for anthropic.
Improve caching of IS_PYPY in gc_data.py for performance
Now checks and caches IS_PYPY once when the module is loaded.
Add Gemini response streaming
- Add response streaming support to Gemini through the google-genai package.
Add
http.statusCodeattribute to transaction events- To conform with the rest of the language agents, the Python agent now sends the http status to the
WebTransactionattributehttp.statusCode. The Python agent will continue to send the attribute toresponse.statusas well, but theresponse.statusattribute will be removed in the future.
- To conform with the rest of the language agents, the Python agent now sends the http status to the
Bugs
Resend modules during reconnect
- The agent previously only sent the module list periodically after the first connect cycle. If the agent reconnected to the collector, this data would not be resubmitted, so the UI would no longer show the module data. This has now been fixed.
Guard garbage collection metrics against re-entrant calls
- Adds a flag to prevent re-entrant calls to
_GCDataSource.record_gc()to prevent infinite recursion on Python 3.13+.
- Adds a flag to prevent re-entrant calls to
Enable task propagation in async generators
- Fixes an issue where
AsyncGeneratorProxywould not properly handle transaction context propagation if spread over multiple tasks.
- Fixes an issue where
Fix Starlette context propagation in
StreamingResponse- Adds trace context propagation to starlette
StreamingResponsefor both synchronous and asynchronous generators.
- Adds trace context propagation to starlette
Support statement
We recommend updating to the latest agent version as soon as it's available. If you can't upgrade to the latest version, update your agents to a version no more than 90 days old. Read more about keeping agents up to date.
See the New Relic Python agent EOL policy for information about agent releases and support dates.