Skip to content

Callback handler の設定見直し - #137

Merged
poad merged 1 commit into
mainfrom
fix/langchain-agent-langfuse
Oct 29, 2025
Merged

Callback handler の設定見直し#137
poad merged 1 commit into
mainfrom
fix/langchain-agent-langfuse

Conversation

@poad

@poad poad commented Oct 29, 2025

Copy link
Copy Markdown
Owner

概要

概要を記述。

変更点

追加・変更・削除したファイル (リポジトリルートからの相対パス) 変更内容 事由
変更したファイルのリポジトリルートからの相対パス どんな変更を行なったのか? 何故、変更が必要だったのか?

関連Issue

確認事項

  • (Typescriptの場合) pnpm audit --fix で脆弱性を修正済みか?
  • (Typescriptの場合) pnpm lint-fix でコードスタイルは修正済みか?
  • (Markdownの場合)markdownlint-2 で Markdown の lint は修正済みか?

特記事項

@amazon-q-developer

Copy link
Copy Markdown
Contributor

Code review in progress. Analyzing for code quality issues and best practices. You can monitor the review status in the checks section at the bottom of this pull request. Detailed findings will be posted upon completion.

Using Amazon Q Developer for GitHub

Amazon Q Developer1 is an AI-powered assistant that integrates directly into your GitHub workflow, enhancing your development process with intelligent features for code development, review, and transformation.

Slash Commands

Command Description
/q <message> Chat with the agent to ask questions or request revisions
/q review Requests an Amazon Q powered code review
/q help Displays usage information

Features

Agentic Chat
Enables interactive conversation with Amazon Q to ask questions about the pull request or request specific revisions. Use /q <message> in comment threads or the review body to engage with the agent directly.

Code Review
Analyzes pull requests for code quality, potential issues, and security concerns. Provides feedback and suggested fixes. Automatically triggered on new or reopened PRs (can be disabled for AWS registered installations), or manually with /q review slash command in a comment.

Customization

You can create project-specific rules for Amazon Q Developer to follow:

  1. Create a .amazonq/rules folder in your project root.
  2. Add Markdown files in this folder to define rules (e.g., cdk-rules.md).
  3. Write detailed prompts in these files, such as coding standards or best practices.
  4. Amazon Q Developer will automatically use these rules when generating code or providing assistance.

Example rule:

All Amazon S3 buckets must have encryption enabled, enforce SSL, and block public access.
All Amazon DynamoDB Streams tables must have encryption enabled.
All Amazon SNS topics must have encryption enabled and enforce SSL.
All Amazon SNS queues must enforce SSL.

Feedback

To provide feedback on Amazon Q Developer, create an issue in the Amazon Q Developer public repository.

For more detailed information, visit the Amazon Q for GitHub documentation.

Footnotes

  1. Amazon Q Developer uses generative AI. You may need to verify generated code before using it in your environment. See the AWS Responsible AI Policy.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

レビュー概要

このPRは、Langfuseコールバックハンドラーの設定を見直し、エージェント作成時にモデルレベルでコールバックを設定するように変更しています。

主な変更点

  • LanguageModelLike型のインポートを追加
  • エージェント作成タイミングをLangfuseハンドラー初期化後に変更
  • モデルにwithConfig()を使用してコールバックを設定

指摘事項

  1. コードフォーマット: カンマの位置を修正してください
  2. コールバック重複: モデルレベルとstreamEventsレベルでのコールバック設定の重複を確認してください

全体評価

コールバックハンドラーの設定方法を改善する良い変更ですが、フォーマットの修正と重複設定の確認が必要です。


Coming soon: You'll be able to request the agent to implement changes and create commits on your pull request's source branch. This may trigger any configured CI/CD workflows automatically.

You can disable any CI/CD workflow that you have configured to run on the source branch of the pull request. For more information, see Disabling and enabling a workflow in the GitHub documentation.

Comment thread rag/cdk/lambda/handler.ts Outdated
Comment thread rag/cdk/lambda/handler.ts Outdated
Comment thread rag/cdk/lambda/handler.ts
@poad
poad force-pushed the fix/langchain-agent-langfuse branch 3 times, most recently from f5441f8 to a007c52 Compare October 29, 2025 04:04
@poad

poad commented Oct 29, 2025

Copy link
Copy Markdown
Owner Author

/q review

@amazon-q-developer

Copy link
Copy Markdown
Contributor

Code review in progress. Analyzing for code quality issues and best practices. You can monitor the review status in the checks section at the bottom of this pull request. Detailed findings will be posted upon completion.

Using Amazon Q Developer for GitHub

Amazon Q Developer1 is an AI-powered assistant that integrates directly into your GitHub workflow, enhancing your development process with intelligent features for code development, review, and transformation.

Slash Commands

Command Description
/q <message> Chat with the agent to ask questions or request revisions
/q review Requests an Amazon Q powered code review
/q help Displays usage information

Features

Agentic Chat
Enables interactive conversation with Amazon Q to ask questions about the pull request or request specific revisions. Use /q <message> in comment threads or the review body to engage with the agent directly.

Code Review
Analyzes pull requests for code quality, potential issues, and security concerns. Provides feedback and suggested fixes. Automatically triggered on new or reopened PRs (can be disabled for AWS registered installations), or manually with /q review slash command in a comment.

Customization

You can create project-specific rules for Amazon Q Developer to follow:

  1. Create a .amazonq/rules folder in your project root.
  2. Add Markdown files in this folder to define rules (e.g., cdk-rules.md).
  3. Write detailed prompts in these files, such as coding standards or best practices.
  4. Amazon Q Developer will automatically use these rules when generating code or providing assistance.

Example rule:

All Amazon S3 buckets must have encryption enabled, enforce SSL, and block public access.
All Amazon DynamoDB Streams tables must have encryption enabled.
All Amazon SNS topics must have encryption enabled and enforce SSL.
All Amazon SNS queues must enforce SSL.

Feedback

To provide feedback on Amazon Q Developer, create an issue in the Amazon Q Developer public repository.

For more detailed information, visit the Amazon Q for GitHub documentation.

Footnotes

  1. Amazon Q Developer uses generative AI. You may need to verify generated code before using it in your environment. See the AWS Responsible AI Policy.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

レビュー結果

このPRは「Callback handler の設定見直し」として、Langfuseのコールバックハンドラーとエージェントの初期化順序を適切に修正しています。

主な改善点

  • ✅ エージェントの初期化をLangfuseハンドラーの後に移動し、依存関係を明確化
  • callbacks設定をconfigurableオブジェクトから適切な位置に移動し、トレーシングが正常に動作するよう修正

提案事項

  • エージェント作成時に直接コールバックハンドラーを渡すことで、より明確な設計にできます
  • 環境変数の不完全な設定に対するエラーハンドリングの追加を検討してください

PR説明について

PR説明のテンプレートが未記入のままです。変更内容、変更理由、関連Issueなどの情報を記載することで、レビューアーや将来のメンテナンスが容易になります。

コードの変更自体は適切で、Langfuseのトレーシング機能が正常に動作するようになる重要な修正です。


Coming soon: You'll be able to request the agent to implement changes and create commits on your pull request's source branch. This may trigger any configured CI/CD workflows automatically.

You can disable any CI/CD workflow that you have configured to run on the source branch of the pull request. For more information, see Disabling and enabling a workflow in the GitHub documentation.

Comment thread rag/cdk/lambda/handler.ts
Comment thread rag/cdk/lambda/handler.ts
@poad
poad force-pushed the fix/langchain-agent-langfuse branch from a007c52 to 436d82b Compare October 29, 2025 04:07
@poad
poad marked this pull request as ready for review October 29, 2025 04:14
@poad
poad merged commit 29f8377 into main Oct 29, 2025
6 checks passed
@poad
poad deleted the fix/langchain-agent-langfuse branch October 29, 2025 04:14
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.

1 participant