Skip to content

feat(AIC-3439): let wildcard handlers accept only named providers - #136

Open
andrewklatzke wants to merge 1 commit into
mainfrom
aklatzke/AIC-3439/scoped-handlers
Open

andrewklatzke wants to merge 1 commit into
mainfrom
aklatzke/AIC-3439/scoped-handlers

Conversation

@andrewklatzke

Copy link
Copy Markdown
Contributor

Summary

  • A wildcard handler can take a providers list, so a LangChain adapter used only for Bedrock accepts config.provider.name == "Bedrock" and no other provider.
  • Exact [provider, mode] still wins. Among scoped wildcards that contain the name, the shortest list wins, then the earlier registration. An unscoped * is the fallback.
  • Registry identity is provides_for plus the provider set, so two scoped wildcards of the same mode can be registered together. Judges, graph selection, and the evaluations runner use the same order.

Test plan

  • uv run pytest on the client, langchain-messages, and langchain-agents suites
  • ruff and mypy on the touched packages
  • Integration success and failure for agent, graph, streaming, graph-streaming, judge, langchain, langchain-messages, langchain-agents, and native-graph-langchain

Made with Cursor

A LangChain adapter used for one provider no longer has to match every provider, and two scoped wildcards of the same mode can be registered together.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrewklatzke

Copy link
Copy Markdown
Contributor Author

Human message:

I think this is a "nice to have" not necessarily "must do it". I'm thinking of situations where, for example, a user might want to use the Google ADK and scope it only to gemini (create_google_adk_handler(providers=['Gemini'])). Another example might be folks wanting to use langchain but only for Bedrock so they don't have to deal with boto.

You can technically achieve this now by properly including the right subset of handlers, but this makes it more obvious/colocates it with the code if you want to scope them down.

tldr; if we think this is confusing or don't want it, we can close it

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ee8f6f0. Configure here.

else:
# No compatible handler — skip rather than calling a provider
# whose allowlist does not include this judge.
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Untyped parent judges now skipped

Medium Severity

The new else: continue skips a judge when _provider_matches is false, and that helper is false whenever the parent has no provides_for. A plain callable that routes itself used to run the judge via the default judge_handler = handler assignment. Evaluations still treat a missing provides_for as covering every judge, so graph() with a single untyped handler now drops configured judges with no error.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ee8f6f0. Configure here.

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