Skip to content

BaseTool.from_config drops T | None arguments on Python 3.11-3.13Β #7840

Closed

Description

@adityasingh2400

πŸ”΄ Required Information

Describe the Bug:
On Python 3.11–3.13, BaseTool.from_config drops every constructor argument annotated with PEP 604 syntax (T | None). Before Python 3.14, get_origin(int | None) is types.UnionType, not typing.Union. The Optional[T] unwrapping (if get_origin(param_type) is Union) is therefore skipped, no branch matches, and the value is discarded with only an "Unsupported parsing for argument" warning.

Several built-in tools rely on the default from_config and annotate their arguments this way, so YAML agent configs silently lose them. Among them:

  • VertexAiRagRetrieval: rag_corpora, rag_resources, similarity_top_k, vector_distance_threshold
  • GoogleSearchTool: model
  • ExecuteBashTool: workspace

A RAG tool configured in YAML ends up retrieving from no corpus.

Steps to Reproduce:

  1. root_agent.yaml:
name: contracts_agent
model: gemini-2.5-flash
instruction: Answer questions from the contract corpus.
tools:
  - name: google.adk.tools.retrieval.vertex_ai_rag_retrieval.VertexAiRagRetrieval
    args:
      name: retrieve_contracts
      description: Retrieves contract clauses.
      rag_corpora:
        - projects/p/locations/us-central1/ragCorpora/123
      similarity_top_k: 5
      vector_distance_threshold: 0.4
  1. agent = config_agent_utils.from_config("root_agent.yaml") and inspect agent.tools[0].vertex_rag_store.

Expected Behavior:
rag_corpora, similarity_top_k and vector_distance_threshold are set from the config.

Observed Behavior:

Unsupported parsing for argument: rag_corpora.
Unsupported parsing for argument: similarity_top_k.
Unsupported parsing for argument: vector_distance_threshold.
rag_corpora: None
similarity_top_k: None
vector_distance_threshold: None

Environment Details:

  • ADK Library Version (pip show google-adk): 2.13.0 (also on main at 75fb788)
  • Desktop OS: macOS
  • Python Version (python -V): 3.11.16

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A (config loading)

🟑 Optional Information

Additional Context:
Optional[T] annotations work, which is why only some arguments are affected. #4371 / #4406 covered PEP 604 unions in function-declaration parsing, not this config path.

How often has this issue occurred?:

  • Always (100%) on Python 3.11–3.13

Activity

  1. sanketpatil06 commented on Nov 2, 2026

    @sanketpatil06

    Hi @adityasingh2400 , thanks for reporting this and sending the fix.
    We investigated this issue and were able to reproduce the behavior on our end. Your PR #7841 is currently under review by our team and it will be merged once approved. Thank you for your patience and understanding.

  2. added a commit that references this issue on Nov 2, 2026
    19e3d5b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

tools[Component] This issue is related to tools

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions