Skip to content

fix(core): accept async-callable instances consistently across Flow, Action, background models, and run_in_new_span #124

In review

Description

@huangjeff5

Tool.__init__ accepts callable instances with async def __call__ (inspect.iscoroutinefunction(type(func).__call__)), while other core entry points still check bare inspect.iscoroutinefunction(...) and reject the same object:

  • Flow.__init__ (packages/genkit/src/genkit/_core/_flow.py:130)
  • Action.__init__ (packages/genkit/src/genkit/_core/_action.py:1017)
  • _background.py:490
  • run_in_new_span (packages/genkit/src/genkit/_core/_telemetry/_instrumentation.py:280)

Extract a shared async-callable check and apply it consistently across these entry points (along with name/docstring fallback where instances lack __name__).

Follow-up from PR #84.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions