Skip to content

Conversation

@NVJKKartik
Copy link
Contributor

@NVJKKartik NVJKKartik commented Jun 11, 2025

Pull Request

Description

Describe the changes in this pull request:

  • What feature/bug does this PR address?
  • Provide any relevant links or screenshots.

Checklist

  • Code compiles correctly.
  • Created/updated tests.
  • Linting and formatting applied.
  • Documentation updated.

Related Issues

Closes #<issue_number>

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive OpenTelemetry instrumentation for Google ADK, enabling rich tracing and observability for AI workflows.
    • Added detailed example scripts and documentation for integrating tracing with Google ADK agents and tools.
    • Released new TypeScript and Python package documentation, including quickstart guides and usage examples.
  • Chores

    • Added and updated TypeScript and Python configuration files to support multiple build targets and improved project structure.
    • Updated package metadata, dependencies, and versioning across multiple packages.
    • Introduced changelog files to track version history for several packages.
  • Style

    • Improved organization and clarity of configuration and documentation files.

@coderabbitai
Copy link

coderabbitai bot commented Jun 11, 2025

Walkthrough

This update introduces new Python and TypeScript instrumentation packages, configuration files, and documentation. The Python changes add a Google ADK auto-instrumentation module with OpenTelemetry tracing, usage examples, and packaging metadata. The TypeScript changes add or update core, semantic conventions, OpenAI, Anthropic, and LangChain packages, including new base and per-package TypeScript config files, changelogs, and enhanced dependency management. Several example scripts and detailed README files are included.

Changes

File(s) Change Summary
python/frameworks/google-adk/.venv/pyvenv.cfg Added Python virtual environment configuration file.
python/frameworks/google-adk/README.md Added README with package description, usage, and example for traceai-google-adk.
python/frameworks/google-adk/examples/testing_google_adk.py Added example script demonstrating Google ADK agent tracing with OpenTelemetry.
python/frameworks/google-adk/pyproject.toml Added Poetry-based package metadata and dependencies for traceAI-google-adk.
python/frameworks/google-adk/traceai_google_adk/init.py Added GoogleADKInstrumentor and _PassthroughTracer classes for OpenTelemetry integration with Google ADK.
python/frameworks/google-adk/traceai_google_adk/_wrappers.py Added wrappers and helpers for tracing Google ADK runners, agents, LLM, and tool calls.
python/frameworks/google-adk/traceai_google_adk/version.py Added version identifier (version = "0.1.0") for the package.
typescript/packages/fi-core/CHANGELOG.md Added changelog documenting fi-core package version history.
typescript/packages/fi-core/README.md Added README with features, setup, and usage for @traceai/fi-core.
typescript/packages/fi-core/package.json Updated version to 0.1.11, reorganized dependencies, updated fi-semantic-conventions version.
typescript/packages/fi-core/tsconfig.esm.json Added ESM-specific TypeScript config extending base ESM config.
typescript/packages/fi-core/tsconfig.esnext.json Added ESNext-specific TypeScript config extending base ESNext config.
typescript/packages/fi-core/tsconfig.json Updated to extend base config, adjusted include patterns, added empty files/references arrays.
typescript/packages/fi-semantic-conventions/CHANGELOG.md Added changelog for fi-semantic-conventions package.
typescript/packages/fi-semantic-conventions/README.md Added README with description and install instructions.
typescript/packages/fi-semantic-conventions/package.json Updated version to 0.1.8.
typescript/packages/fi-semantic-conventions/tsconfig.esm.json Added ESM-specific TypeScript config.
typescript/packages/fi-semantic-conventions/tsconfig.esnext.json Added ESNext-specific TypeScript config.
typescript/packages/fi-semantic-conventions/tsconfig.json Updated to extend base config, adjusted include patterns, added empty files/references arrays.
typescript/packages/traceai_anthropic/CHANGELOG.md Added changelog for traceai_anthropic package.
typescript/packages/traceai_anthropic/package.json Updated version to 0.1.1, set internal dependencies to specific versions.
typescript/packages/traceai_anthropic/tsconfig.esm.json Added ESM-specific TypeScript config.
typescript/packages/traceai_anthropic/tsconfig.esnext.json Added ESNext-specific TypeScript config.
typescript/packages/traceai_anthropic/tsconfig.json Updated to extend base config, adjusted include patterns, removed references.
typescript/packages/traceai_langchain/tsconfig.esm.json Added ESM-specific TypeScript config.
typescript/packages/traceai_langchain/tsconfig.esnext.json Added ESNext-specific TypeScript config.
typescript/packages/traceai_langchain/tsconfig.json Updated to extend base config, adjusted compilerOptions, include, and removed references/paths.
typescript/packages/traceai_openai/CHANGELOG.md Added changelog for traceai_openai package.
typescript/packages/traceai_openai/examples/manual.ts Added example showing combined manual and auto-instrumentation with OpenAI API.
typescript/packages/traceai_openai/package.json Updated version to 0.1.12, set internal dependencies to specific versions, updated peer dependency range.
typescript/packages/traceai_openai/src/instrumentation.ts Extended supported OpenAI versions to include ^5.0.0.
typescript/packages/traceai_openai/tsconfig.esm.json Added ESM-specific TypeScript config.
typescript/packages/traceai_openai/tsconfig.esnext.json Added ESNext-specific TypeScript config.
typescript/packages/traceai_openai/tsconfig.json Updated to extend base config, adjusted compilerOptions, include, and removed references.
typescript/tsconfig.base.es5.json Added ES5-specific base TypeScript config.
typescript/tsconfig.base.esm.json Added base ESM TypeScript config extending ESNext config.
typescript/tsconfig.base.esnext.json Added base ESNext TypeScript config.
typescript/tsconfig.base.json Added new base TypeScript configuration file with strict and incremental options.
typescript/tsconfig.json Deleted previous root TypeScript config file.

Sequence Diagram(s)

sequenceDiagram
    participant UserScript as User Script
    participant GoogleADKInstrumentor as GoogleADKInstrumentor
    participant GoogleADK as Google ADK (Agent/Runner)
    participant OpenTelemetry as OpenTelemetry Tracer

    UserScript->>GoogleADKInstrumentor: Instrument Google ADK
    GoogleADKInstrumentor->>GoogleADK: Patch run_async and tracing functions
    UserScript->>GoogleADK: Create Agent and Runner
    UserScript->>GoogleADK: Run Agent (async)
    GoogleADK->>OpenTelemetry: Start tracing span (via wrapper)
    GoogleADK-->>UserScript: Yield events/responses
    GoogleADK->>OpenTelemetry: End span, record attributes
Loading

Poem

In fields of code where traces grow,
A rabbit hops where signals flow.
With OpenTelemetry spun anew,
Google ADK now shines right through!
TypeScript configs, docs in tow—
Our burrow’s bright, observability aglow!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@NVJKKartik NVJKKartik requested a review from JayaSurya-27 June 11, 2025 08:43
@JayaSurya-27 JayaSurya-27 changed the base branch from main to dev June 11, 2025 08:47
@JayaSurya-27 JayaSurya-27 merged commit 006e8d9 into dev Jun 11, 2025
1 check was pending
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 10

♻️ Duplicate comments (4)
typescript/packages/traceai_anthropic/tsconfig.esnext.json (1)

1-10: Duplicate ESNext configuration
This file mirrors the traceai_openai/tsconfig.esnext.json setup. All settings are consistent with the project-wide standard.

typescript/packages/traceai_anthropic/tsconfig.esm.json (1)

1-10: Duplicate ESM configuration
This file matches traceai_openai/tsconfig.esm.json exactly, following the same extension of the base ESM config and output conventions.

typescript/packages/traceai_langchain/tsconfig.esm.json (1)

1-10: Duplicate: ESM config recommendations
The same suggestions for enabling declarations and cleaning up empty references apply here as in fi-semantic-conventions/tsconfig.esm.json.

typescript/packages/traceai_langchain/tsconfig.esnext.json (1)

1-10: Duplicate: ESNext config recommendations
Refer to the review on fi-semantic-conventions/tsconfig.esnext.json for enabling declaration, declarationMap, and incremental, and removing the empty references.

🧹 Nitpick comments (23)
typescript/packages/fi-semantic-conventions/README.md (1)

1-17: README provides basic usage but could be enriched.

Consider adding a brief package overview, a license badge, and example attribute definitions common to this package. Also remove extra blank lines at the end to tighten formatting.

typescript/tsconfig.base.es5.json (1)

1-7: Enhance ES5 base config
Consider adding standard compiler options for ES5 targets, such as "lib": ["es5", "dom"], "module": "commonjs", and "strict": true, to ensure broader compatibility and stricter type checks.

typescript/packages/traceai_anthropic/CHANGELOG.md (2)

1-4: Clarify dependency updates in v0.1.1
Currently the change log entry simply states "Dependencies Updated". Consider specifying which dependencies were updated (e.g., @traceai/fi-core, @traceai/fi-semantic-conventions) or linking relevant issue/PR numbers.


6-9: Improve initial release notes
The v0.1.0 entry could include more context, such as key features ("Anthropic LLM support") or a link to the PR/issue that introduced this support.

typescript/packages/traceai_openai/package.json (1)

3-3: Bump package version to 0.1.12
Ensure that the project’s CHANGELOG.md or release notes have been updated to reflect any new features, fixes, or breaking changes introduced in this release.

typescript/packages/fi-core/CHANGELOG.md (2)

2-5: Inconsistent section heading under 0.1.10
Under the “### Feature” header, you have a bullet - Bug Fixes instead of starting a new “### Bug Fixes” section.


7-23: Provide concrete details for previous releases
Entries like - Bug Fixes or - Dependencies Updated lack specifics on what was fixed or updated. Consider adding brief bullet points for each changelog entry to improve traceability.

typescript/packages/fi-semantic-conventions/tsconfig.esm.json (1)

1-10: Ensure type declarations in ESM build
To emit typings and enable faster incremental builds, consider adding declaration, declarationMap, and incremental flags. Also, you can omit the empty "references": [] when not using project references.

Apply this diff:

 {
   "extends": "../../tsconfig.base.esm.json",
   "compilerOptions": {
     "outDir": "dist/esm",
     "rootDir": "src",
+    "declaration": true,
+    "declarationMap": true,
+    "incremental": true,
     "tsBuildInfoFile": "dist/esm/tsconfig.esm.tsbuildinfo"
   },
   "include": ["src/**/*.ts"]
-  ,"references": []
+  // removed empty references
 }

Please verify that tsconfig.base.esm.json doesn’t already enable these settings.

typescript/packages/fi-semantic-conventions/tsconfig.esnext.json (1)

1-10: Ensure type declarations in ESNext build
Similar to the ESM config, add declaration, declarationMap, and incremental under compilerOptions and remove the empty references entry for cleaner configs:

 {
   "extends": "../../tsconfig.base.esnext.json",
   "compilerOptions": {
     "outDir": "dist/esnext",
     "rootDir": "src",
+    "declaration": true,
+    "declarationMap": true,
+    "incremental": true,
     "tsBuildInfoFile": "dist/esnext/tsconfig.esnext.tsbuildinfo"
   },
   "include": ["src/**/*.ts"]
-  ,"references": []
+  // removed empty references
 }

Confirm whether tsconfig.base.esnext.json already covers these flags.

typescript/packages/fi-semantic-conventions/CHANGELOG.md (1)

1-27: Changelog Traceability: Add Links and Details.

The chronological entries cover versions 0.1.0–0.1.8, but they lack PR/issue references or brief descriptions of what changed.
Consider linking to PRs or commits and adding concise feature/fix descriptions for transparency.

typescript/packages/fi-core/tsconfig.esm.json (1)

9-9: Consider removing empty references
An empty "references": [] is redundant when not using project references; you can drop it to keep the config lean.

typescript/packages/traceai_anthropic/tsconfig.json (2)

7-7: Remove redundant files array
An empty "files": [] isn’t needed when you’re already using "include"; consider deleting it for clarity.


9-9: Drop empty references
Since there are no project references, the "references": [] block can be removed to simplify the config.

typescript/packages/traceai_openai/tsconfig.json (2)

7-7: Remove unused files property
The empty "files": [] adds noise—drop it since "include" handles your file globs.


9-9: Omit empty references
No project references are used, so the "references": [] section can be safely removed.

python/frameworks/google-adk/pyproject.toml (1)

12-17: Add dev-dependencies for testing and linting
There are no dev dependencies (pytest, mypy, black, etc.). Consider adding them under [tool.poetry.dev-dependencies] for a reproducible development environment.

typescript/packages/traceai_langchain/tsconfig.json (2)

7-7: Remove redundant files entry
The empty "files": [] can be removed when "include" covers your glob patterns.


9-9: Omit unused references
Empty "references": [] isn’t necessary without project references; consider removing it.

python/frameworks/google-adk/README.md (1)

10-10: Fix minor typographical issues in the documentation.

Please address these grammatical improvements:

-In this example we will instrument a small program that uses Gemini and observe the traces in Future AGI Dashboard
+In this example, we will instrument a small program that uses Gemini and observe the traces in Future AGI Dashboard
-Run the python file to send the traces to Future AGI Platform.
+Run the python file to send the traces to the Future AGI Platform.

Also applies to: 105-105

🧰 Tools
🪛 LanguageTool

[typographical] ~10-~10: It appears that a comma is missing.
Context: ...or Google ADK. ## Quickstart In this example we will instrument a small program that...

(DURING_THAT_TIME_COMMA)

python/frameworks/google-adk/examples/testing_google_adk.py (1)

32-44: Simplify the control flow by removing unnecessary else.

The else block is unnecessary after a return statement:

 def get_weather(city: str) -> dict:
     """Retrieves the current weather report for a specified city.
 
     Args:
         city (str): The name of the city for which to retrieve the weather report.
 
     Returns:
         dict: status and result or error msg.
     """
     if city.lower() == "new york":
         return {
             "status": "success",
             "report": (
                 "The weather in New York is sunny with a temperature of 25 degrees"
                 " Celsius (77 degrees Fahrenheit)."
             ),
         }
-    else:
-        return {
-            "status": "error",
-            "error_message": f"Weather information for '{city}' is not available.",
-        }
+    return {
+        "status": "error",
+        "error_message": f"Weather information for '{city}' is not available.",
+    }
🧰 Tools
🪛 Pylint (3.3.7)

[refactor] 32-44: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it

(R1705)

typescript/packages/traceai_openai/examples/manual.ts (1)

310-319: Consider awaiting shutdown directly instead of using setTimeout.

The fixed 2-second delay might not be sufficient for all spans to be exported, especially with network delays.

Replace the setTimeout approach with direct await:

    } finally {
-        // Give time for spans to be exported
-        setTimeout(async () => {
-            try {
-                await tracerProvider.shutdown();
-                console.log("Tracer provider shut down successfully.");
-            } catch (error) {
-                console.error("Error shutting down tracer provider:", error);
-            }
-        }, 2000);
+        // Ensure all spans are exported before shutting down
+        try {
+            await tracerProvider.shutdown();
+            console.log("Tracer provider shut down successfully.");
+        } catch (error) {
+            console.error("Error shutting down tracer provider:", error);
+        }
    }
python/frameworks/google-adk/traceai_google_adk/_wrappers.py (2)

328-341: Simplify nested if statements.

The nested if statements can be combined for better readability.

        if event := next((arg for arg in arguments.values() if isinstance(arg, Event)), None):
-            if responses := event.get_function_responses():
+        if event := next((arg for arg in arguments.values() if isinstance(arg, Event)), None):
+            if responses := event.get_function_responses():
                try:
                    span.set_attribute(
                        SpanAttributes.OUTPUT_VALUE,
                        responses[0].model_dump_json(exclude_none=True),
                    )
                    span.set_attribute(
                        SpanAttributes.OUTPUT_MIME_TYPE,
                        FiMimeTypeValues.JSON.value,
                    )
                except Exception:
                    logger.exception(f"Failed to get attribute in {wrapped.__name__}.")

Actually, combine the conditions:

-        if event := next((arg for arg in arguments.values() if isinstance(arg, Event)), None):
-            if responses := event.get_function_responses():
+        if (event := next((arg for arg in arguments.values() if isinstance(arg, Event)), None)) and (responses := event.get_function_responses()):
🧰 Tools
🪛 Ruff (0.11.9)

328-329: Use a single if statement instead of nested if statements

(SIM102)


512-522: Remove unnecessary else after return.

The else block is unnecessary when the if block contains a return statement.

 def _default(obj: Any) -> str:
     from pydantic import BaseModel
 
     if isinstance(obj, BaseModel):
         return json.dumps(
             obj.model_dump(exclude=None),
             ensure_ascii=False,
             default=str,
         )
-    else:
-        return str(obj)
+    return str(obj)
🧰 Tools
🪛 Pylint (3.3.7)

[refactor] 515-522: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it

(R1705)

🛑 Comments failed to post (10)
python/frameworks/google-adk/.venv/pyvenv.cfg (1)

1-5: ⚠️ Potential issue

Remove committed virtual environment
Committing the .venv directory is not recommended. It can bloat the repository and introduce environment-specific paths. Please add .venv/ to .gitignore and remove this file from version control.

🤖 Prompt for AI Agents
In python/frameworks/google-adk/.venv/pyvenv.cfg lines 1 to 5, the virtual
environment configuration file is committed, which is not recommended. Remove
the entire .venv directory from version control by deleting it from the
repository and add ".venv/" to the .gitignore file to prevent future commits of
the virtual environment.
typescript/packages/traceai_openai/CHANGELOG.md (1)

1-32: ⚠️ Potential issue

Changelog Out of Sync with Package Version.

The changelog tops out at 0.1.10, but package.json was bumped to 0.1.12 in this PR. Entries for 0.1.11 and 0.1.12 are missing.
Please update the changelog to include those versions with appropriate notes, and consider adding PR/commit links.

🤖 Prompt for AI Agents
In typescript/packages/traceai_openai/CHANGELOG.md lines 1 to 32, the changelog
is missing entries for versions 0.1.11 and 0.1.12, which are present in
package.json. Add changelog sections for these versions with relevant feature or
fix notes, and optionally include PR or commit links for better traceability.
python/frameworks/google-adk/pyproject.toml (1)

4-4: ⚠️ Potential issue

Fix package description
The description reads "OpenTelemetry instrumentation for Anthropic" but this package targets Google ADK. Please update it to reflect Google ADK instrumentation.

🤖 Prompt for AI Agents
In python/frameworks/google-adk/pyproject.toml at line 4, the package
description incorrectly states it is for Anthropic. Update the description
string to accurately reflect that this package provides OpenTelemetry
instrumentation for Google ADK instead.
python/frameworks/google-adk/examples/testing_google_adk.py (1)

8-10: ⚠️ Potential issue

Remove unused imports.

These imports are not used in the example and should be removed:

-from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
-from opentelemetry.sdk import trace as trace_sdk
-from opentelemetry.sdk.trace.export import ConsoleSpanExporter, SimpleSpanProcessor
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.


🧰 Tools
🪛 Ruff (0.11.9)

8-8: opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter imported but unused

Remove unused import: opentelemetry.exporter.otlp.proto.http.trace_exporter.OTLPSpanExporter

(F401)


9-9: opentelemetry.sdk.trace imported but unused

Remove unused import: opentelemetry.sdk.trace

(F401)


10-10: opentelemetry.sdk.trace.export.ConsoleSpanExporter imported but unused

Remove unused import

(F401)


10-10: opentelemetry.sdk.trace.export.SimpleSpanProcessor imported but unused

Remove unused import

(F401)

🤖 Prompt for AI Agents
In python/frameworks/google-adk/examples/testing_google_adk.py around lines 8 to
10, remove the unused imports OTLPSpanExporter and trace_sdk since they are not
used anywhere in the example code. Keep only the imports that are actually
utilized to clean up the code.
python/frameworks/google-adk/traceai_google_adk/__init__.py (2)

34-40: ⚠️ Potential issue

Fix indentation issue in FITracer instantiation.

The indentation is incorrect and should be aligned properly:

         self._tracer = cast(
             Tracer,
-        FITracer(
+            FITracer(
                 trace_api.get_tracer(__name__, __version__, tracer_provider),
                 config=config,
             ),
         )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

        self._tracer = cast(
            Tracer,
            FITracer(
                trace_api.get_tracer(__name__, __version__, tracer_provider),
                config=config,
            ),
        )
🤖 Prompt for AI Agents
In python/frameworks/google-adk/traceai_google_adk/__init__.py around lines 34
to 40, the instantiation of FITracer is incorrectly indented. Adjust the
indentation so that FITracer and its parameters are properly aligned under the
cast function call, ensuring consistent and clear code structure.

119-135: ⚠️ Potential issue

Fix incorrect import path in _unpatch_trace_tool_call.

The import path on line 121 appears to be incorrect. It should import directly from functions module rather than through base_llm_flow:

     def _unpatch_trace_tool_call(self) -> None:
         """Restore the original tool call tracing functionality."""
-        from google.adk.flows.llm_flows.base_llm_flow import functions  # type: ignore[attr-defined]
+        from google.adk.flows.llm_flows import functions
 
         if callable(
             original := getattr(functions.trace_tool_call, "__wrapped__"),  # type: ignore[attr-defined]
         ):
-            from google.adk.flows.llm_flows.base_llm_flow import (  # type: ignore[attr-defined]
-                functions,
-            )
-
             setattr(functions, "trace_tool_call", original)
 
         from google.adk.telemetry import tracer
 
         setattr(functions, "tracer", tracer)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    def _unpatch_trace_tool_call(self) -> None:
        """Restore the original tool call tracing functionality."""
        from google.adk.flows.llm_flows import functions

        if callable(
            original := getattr(functions.trace_tool_call, "__wrapped__"),  # type: ignore[attr-defined]
        ):
            setattr(functions, "trace_tool_call", original)

        from google.adk.telemetry import tracer

        setattr(functions, "tracer", tracer)
🧰 Tools
🪛 Ruff (0.11.9)

124-124: Do not call getattr with a constant attribute value. It is not any safer than normal property access.

Replace getattr with attribute access

(B009)


130-130: Do not call setattr with a constant attribute value. It is not any safer than normal property access.

Replace setattr with assignment

(B010)


134-134: Do not call setattr with a constant attribute value. It is not any safer than normal property access.

Replace setattr with assignment

(B010)

🪛 Pylint (3.3.7)

[error] 121-121: No name 'adk' in module 'google'

(E0611)


[error] 126-128: No name 'adk' in module 'google'

(E0611)


[error] 132-132: No name 'adk' in module 'google'

(E0611)

🤖 Prompt for AI Agents
In python/frameworks/google-adk/traceai_google_adk/__init__.py around lines 119
to 135, the import statement on line 121 incorrectly imports 'functions' via
'base_llm_flow'. Change the import to directly import 'functions' from its
correct module path instead of through 'base_llm_flow' to fix the import path
error.
typescript/packages/fi-core/README.md (2)

45-60: ⚠️ Potential issue

Add missing imports to the code example.

The advanced configuration example uses EvalTagType and ModelChoices without importing them, which would cause TypeScript compilation errors.

Add the missing imports at the beginning of the code block:

-import { register, ProjectType, EvalTag, EvalName, EvalSpanKind } from '@traceai/fi-core';
+import { register, ProjectType, EvalTag, EvalName, EvalSpanKind, EvalTagType, ModelChoices } from '@traceai/fi-core';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

import { register, ProjectType, EvalTag, EvalName, EvalSpanKind, EvalTagType, ModelChoices } from '@traceai/fi-core';

// Create evaluation tags for AI model monitoring
const evalTags = [
    new EvalTag({
        type: EvalTagType.OBSERVATION_SPAN,
        value: EvalSpanKind.LLM,
        eval_name: EvalName.CONTEXT_ADHERENCE,
        custom_eval_name: 'custom_context_check',
        mapping: {
            "context": "raw.input",
            "output": "raw.output"
        },
        model: ModelChoices.TURING_SMALL
    })
]
🤖 Prompt for AI Agents
In typescript/packages/fi-core/README.md around lines 45 to 60, the code example
uses EvalTagType and ModelChoices without importing them, causing TypeScript
errors. Add EvalTagType and ModelChoices to the import statement from
'@traceai/fi-core' at the top of the code block to fix the missing imports
issue.

124-143: ⚠️ Potential issue

Add missing imports to the LLM tracing example.

The example is missing several required imports that are used in the code.

Update the import statement to include all necessary symbols:

-import { register, ProjectType } from '@traceai/fi-core';
+import { register, ProjectType, EvalTag, EvalTagType, EvalSpanKind, EvalName, ModelChoices } from '@traceai/fi-core';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

import { trace } from '@opentelemetry/api';
-import { register, ProjectType } from '@traceai/fi-core';
+import { register, ProjectType, EvalTag, EvalTagType, EvalSpanKind, EvalName, ModelChoices } from '@traceai/fi-core';
🤖 Prompt for AI Agents
In typescript/packages/fi-core/README.md around lines 124 to 143, the example
code for LLM tracing is missing several required imports such as EvalTag,
EvalTagType, EvalSpanKind, EvalName, and ModelChoices. Update the import
statements at the top of the snippet to include all these missing symbols from
their respective modules so the example code can run without import errors.
typescript/packages/traceai_openai/examples/manual.ts (1)

64-64: 💡 Verification agent

🧩 Analysis chain

Verify the OpenAI model name is valid.

The example uses "gpt-4o-mini" which may need verification for validity.

Also applies to: 126-126, 189-189, 223-223, 256-256


🌐 Web query:

Is "gpt-4o-mini" a valid OpenAI model name? What are the currently available OpenAI GPT-4 model variants?

💡 Result:

Validity of "gpt-4o-mini" as an OpenAI Model Name

Yes, "gpt-4o-mini" is a valid OpenAI model name. This designation refers to the lightweight, cost-effective, and smaller version of the GPT-4o family—often dubbed "mini"—designed to offer strong performance at a lower cost and with reduced latency compared to the full-size GPT-4o model. Multiple sources confirm its existence and availability, both in documentation and in third-party guides[6][8][10]. For instance, OpenAI's own documentation and API references explicitly mention "gpt-4o-mini", and it is used as a model option in several platforms[8][10].

Currently Available OpenAI GPT-4 Model Variants

As of June 2025, OpenAI provides several GPT-4 family model variants, including both flagship and cost-optimized options. The main variants available are:

Model Name Description/Notes
gpt-4.1 Latest flagship GPT-4 model, excels at complex tasks
gpt-4.1-mini Smaller, faster, and more affordable than full GPT-4.1
gpt-4.1-nano Ultra-fast, lowest-latency model in the series
gpt-4o "Omni" flagship, multimodal (text, image, audio)
gpt-4o-mini Lightweight, cheaper version of GPT-4o
gpt-4o-audio-preview For audio input/output tasks
gpt-4.5 (limited) Advanced variant, available only in ChatGPT Plus/Pro
gpt-4-turbo (phased) Fast, cost-efficient variant, used in recent years
  • gpt-4.1, gpt-4.1-mini, gpt-4.1-nano: These are the newest models released in 2025 with major improvements in coding, instruction following, and context comprehension. The "mini" and "nano" variants provide speed and affordability, with "nano" optimized for the lowest latency and cost[1][2][10].
  • gpt-4o and gpt-4o-mini: The GPT-4o series is OpenAI’s flagship multimodal offering, with "mini" as the budget-friendly, smaller version. Both support text and image inputs; "mini" delivers strong reasoning and multimodal API capabilities at a much lower price point[6][8][10].
  • gpt-4-turbo: While prominent in 2023–2024, "turbo" models are gradually being replaced by the latest 4.1 family and "omni" models, but may still exist in some offerings[5][7].
  • gpt-4.5: OpenAI’s most advanced model as of 2025, but its availability is limited to ChatGPT Plus and Pro subscriptions rather than general API access[7].

Additional Notes

  • The model name "gpt-4o-mini" is sometimes aliased as "4o-mini" in API references[10].
  • Other variants like "gpt-4o-audio-preview" and context-specific models (for audio or vision tasks) are available for specialized use cases[2][4][10].
  • Model availability can depend on the platform (OpenAI, Azure OpenAI Service, etc.) and user subscription level.

Summary

  • "gpt-4o-mini" is a valid OpenAI model name and represents a smaller, cheaper, and still highly capable version of the GPT-4o multimodal model[6][8][10].
  • Currently available OpenAI GPT-4 model variants include gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, and specialized models like gpt-4o-audio-preview, alongside legacy options such as gpt-4-turbo and limited-access gpt-4.5[1][2][7][8][10].

Citations:


Model name “gpt-4o-mini” is valid—no changes needed

The OpenAI model “gpt-4o-mini” is a recognized, cost-optimized GPT-4o variant as of June 2025. You can leave all instances (lines 64, 126, 189, 223, 256) unchanged.

However, the fixed 2 s setTimeout for graceful shutdown may still cut off spans if they exceed that window. Consider one of the following improvements:

  • Use the OpenTelemetry SDK’s tracerProvider.shutdown() (or equivalent) to flush and close all span processors before exiting.
  • Increase the timeout or loop until all pending spans are exported.
  • Return a promise that resolves once the exporter confirms a clean shutdown.

Locations to update:
• typescript/packages/traceai_openai/examples/manual.ts (lines 310–319)

🤖 Prompt for AI Agents
In typescript/packages/traceai_openai/examples/manual.ts around lines 310 to
319, improve the graceful shutdown logic by replacing the fixed 2-second
setTimeout with a proper shutdown of the OpenTelemetry tracer provider. Use the
tracerProvider.shutdown() method or equivalent to ensure all spans are flushed
and exported before the process exits. Alternatively, increase the timeout or
implement a loop to wait until all pending spans are exported, or return a
promise that resolves after a clean shutdown confirmation from the exporter.
python/frameworks/google-adk/traceai_google_adk/_wrappers.py (1)

104-105: 🛠️ Refactor suggestion

Improve exception handling by catching specific exceptions.

Using bare except clauses can hide unexpected errors and make debugging difficult.

Consider catching specific exceptions. For JSON serialization errors:

-        except Exception:
-            logger.exception(f"Failed to get attribute: {SpanAttributes.INPUT_VALUE}.")
+        except (TypeError, ValueError) as e:
+            logger.exception(f"Failed to serialize attribute {SpanAttributes.INPUT_VALUE}: {e}")

Also applies to: 139-140, 186-187, 233-234, 327-328, 340-341, 351-351

🤖 Prompt for AI Agents
In python/frameworks/google-adk/traceai_google_adk/_wrappers.py around lines
104-105 and similarly at lines 139-140, 186-187, 233-234, 327-328, 340-341, and
351, the code uses bare except clauses which can obscure unexpected errors.
Replace these bare except blocks with specific exception handling, such as
catching JSON serialization errors (e.g., json.JSONDecodeError or TypeError) or
other relevant exceptions. This will improve error clarity and debugging by only
catching anticipated exceptions.

@nik13 nik13 deleted the feature/traceai-google-adk branch July 1, 2025 19:33
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.

3 participants