Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1caceff
fix(py): export missing public types, require input on typed actions,…
huangjeff5 Nov 12, 2026
1363fb4
fix(py): keep ActionResponse out of genkit.plugin_api
huangjeff5 Nov 12, 2026
0df3bdc
docs(py): clarify why ref config TypeVars default to Any
huangjeff5 Nov 12, 2026
18cff5d
chore(py): remove unused CheckOpFn and CancelOpFn aliases
huangjeff5 Nov 12, 2026
43c4f81
Merge remote-tracking branch 'origin/main' into HEAD
huangjeff5 Nov 16, 2026
0d36862
chore(py): unquote ActionContext annotation after merge
huangjeff5 Nov 16, 2026
3bdcf41
fix(py): drop Tool.__new__ overloads so copy and subclassing work again
huangjeff5 Nov 16, 2026
047575f
fix(py): keep ModelFn and McpServerEntry out of the public exports
huangjeff5 Nov 16, 2026
74676ca
fix(py): restore typed GenerationUsage.from_messages signature
huangjeff5 Nov 16, 2026
fd66387
fix(py): keep McpServerEntry exported for mcp_servers built in a vari…
huangjeff5 Nov 16, 2026
756770e
fix(py): let flows and tools with a defaulted input run with no input
huangjeff5 Nov 16, 2026
2d3806a
fix(py): make action input contravariant
huangjeff5 Nov 16, 2026
c31cc69
fix(py)!: tools treat an explicit None as a value, like flows
huangjeff5 Nov 16, 2026
848b91d
fix(py)!: type defaulted flows and tools as DefaultedFlow / Defaulted…
huangjeff5 Nov 16, 2026
62ac92f
fix(py): type a defaulted input followed by a context
huangjeff5 Nov 16, 2026
fbcbdee
fix(py): add a catch-all handler overload and pin every shape in cont…
huangjeff5 Nov 16, 2026
d4f9c0c
fix(py): reject keyword-only handler params and drop the catch-all ov…
huangjeff5 Nov 16, 2026
54115f8
test(py): separate an omitted input from an explicit None in the shap…
huangjeff5 Nov 16, 2026
ec7d06d
fix(py): accept a ref picked between providers when no config is passed
huangjeff5 Nov 16, 2026
d784714
test(py): note the ty overload-order bug behind the define_prompt pin
huangjeff5 Nov 16, 2026
80f822e
test(py): pin keyword-only action invariant across kinds and defaulte…
huangjeff5 Nov 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/genkit-fastapi/src/genkit_fastapi/_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ async def handler(request: Request) -> Response:

return await handle_genkit_request(
request,
action=cast(Action[InputT, OutputT, ChunkT, InitT], action), # ty: ignore[redundant-cast]
action=cast(Action[InputT, OutputT, ChunkT, InitT], action),
context=action_context,
)

Expand Down
3 changes: 2 additions & 1 deletion packages/genkit-mcp/src/genkit_mcp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"""

from genkit_mcp._client import McpClient, define_mcp_client
from genkit_mcp._config import McpServerEntry
from genkit_mcp._host import McpHost, define_mcp_host

__all__ = ['McpClient', 'McpHost', 'define_mcp_client', 'define_mcp_host']
__all__ = ['McpClient', 'McpHost', 'McpServerEntry', 'define_mcp_client', 'define_mcp_host']
2 changes: 1 addition & 1 deletion packages/genkit-mcp/tests/mcp_exports_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@


def test_the_package_exports_exactly_its_public_surface() -> None:
assert genkit_mcp.__all__ == ['McpClient', 'McpHost', 'define_mcp_client', 'define_mcp_host']
assert genkit_mcp.__all__ == ['McpClient', 'McpHost', 'McpServerEntry', 'define_mcp_client', 'define_mcp_host']
for name in genkit_mcp.__all__:
assert getattr(genkit_mcp, name) is not None
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

"""Type-checker contract for building ``mcp_servers`` away from the call.

A dict literal assigned to a variable infers as ``dict[str, dict[str, str]]``
and fails every checker against ``Mapping[str, McpServerEntry]``. Annotating
the variable with the exported ``McpServerEntry`` is the typed way to do it.
"""

from genkit_mcp import McpHost, McpServerEntry, define_mcp_host
from typing_extensions import assert_type

from genkit import Genkit


def test_servers_built_in_a_variable_pass_define_mcp_host() -> None:
"""``dict[str, McpServerEntry]`` built ahead of the call type-checks and registers."""
ai = Genkit()

# 1. Build the servers block once, e.g. from app settings
servers: dict[str, McpServerEntry] = {
'menu': {'command': 'uvx', 'args': ['menu-mcp-server']},
'orders': {'command': 'npx', 'args': ['orders-mcp'], 'env': {'REGION': 'us'}},
}

# 2. Pass it to the host; connection is lazy, so nothing starts here
host = define_mcp_host(ai, 'bistro', mcp_servers=servers)
assert_type(host, McpHost)
Loading
Loading