Skip to content

[fix] accept None for Any-typed TypedDict input fields - #10281

Open
Lesereingrape wants to merge 1 commit into
agno-agi:mainfrom
Lesereingrape:fix-typed-dict-any-none-field
Open

Lesereingrape wants to merge 1 commit into
agno-agi:mainfrom
Lesereingrape:fix-typed-dict-any-none-field

Conversation

@Lesereingrape

@Lesereingrape Lesereingrape commented Sep 18, 2026 •

Copy link
Copy Markdown

Summary

check_type_compatibility() short-circuited on a None value before reaching its expected_type is Any branch, so validate_input() rejected None for a field annotated typing.Any in an input_schema TypedDict — with a self-contradictory message (Field 'metadata' expected type typing.Any, got <class 'NoneType'>).

Any admits every value, so the Any check now runs before the None/Optional handling. The None branch itself is untouched, so None is still rejected for concretely typed fields.

Closes #10280

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Improvement
  • Model update
  • Other:

Checklist

  • Code complies with style guidelines
  • Ran format/validation scripts (./scripts/format.sh and ./scripts/validate.sh)
  • Self-review completed
  • Documentation updated (comments, docstrings)
  • Examples and guides: Relevant cookbook examples have been included or updated (if applicable)
  • Tested in clean environment
  • Tests added/updated (if applicable)

Duplicate and AI-Generated PR Check

  • I have searched existing open pull requests and confirmed that no other PR already addresses this issue
  • If a similar PR exists, I have explained below why this PR is a better approach
  • Check if this PR was entirely AI-generated (by Copilot, Claude Code, Cursor, etc.)

Additional Notes

How this was verified

  • Reproduced the failure against current main (f1cb6a3) before the change, and confirmed it passes after.
  • libs/agno/tests/unit/agent/test_input_schema.py: 1 failed / 24 passed before the source change (the new Any + None case), 25 passed after.
  • Full libs/agno/tests/unit/agent suite compared before and after: the only status change is the new test flipping to pass — 0 regressions. (20 pre-existing failures and 5 collection errors in that suite are unrelated to this change; they come from optional extras missing in the local env, e.g. fastapi.)
  • ruff check, ruff format --check and mypy are clean on both changed files.

Collision check

Searched open issues and PRs for check_type_compatibility / validate_typed_dict (no hits), then scanned the changed-file lists of all 762 open PRs. Two touch libs/agno/agno/utils/common.py:

Neither overlaps check_type_compatibility (lines 56–89) or the test file, so the change is independent of both.

AI-generated disclosure: the code and tests in this PR were written by an AI coding agent, and every line of the diff was read by that same agent, which also ran every check listed above. No human has reviewed this diff, so the self-review box above is the agent's own review. (This sentence replaced the wording “reviewed line by line by the author” on 2026-09-20; a body edit leaves no public trace, so the correction is stated here.)


AI assistance (per CONTRIBUTING.md §5): the investigation, the diff and this description were produced by an AI coding agent working under the account owner's standing instruction to find and fix defects of this kind and open PRs for them; no human read the diff before it was opened. Everything quoted in the validation section was run by that agent on a local checkout and is reproducible on a fresh clone of this branch. The commit carries no AI co-author trailer.

`check_type_compatibility` short-circuits on a None value before it ever
reaches the `expected_type is Any` branch, so `validate_input` rejected
`None` for an `Any` field with "expected type typing.Any". `Any` admits
every value, so check it first.
@Lesereingrape

Copy link
Copy Markdown
Author

Real CI has not run on this PR yet - it needs one click from someone with write access.

The three workflow runs on head 1e36066b (PR Lint twice and Validation) are all completed / action_required, i.e. queued and waiting for a maintainer to press Approve and run. The only check that has actually executed is the automatic Triage PR (success), which is why the merge box reads blocked: it is a missing approval, not a failing check.

The verification I do control - the ruff and mypy runs and the test results they produced - is recorded in the description above; I am not adding new claims here.

The other six PRs from this account are in the same state (#10287, #10297, #10301, #10320, #10323, #10325), each with 2-3 runs awaiting approval. The repo-wide queue is large, so I realise this is not a trivial ask; say the word and I will narrow the set down.

Disclosure: this account is being operated by an AI coding assistant on the owner's instruction, and the PR bodies say so as well.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

validate_input rejects None for Any-typed TypedDict input fields

1 participant